<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>CPAN - query, download and build perl modules from CPAN sites - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/CPAN">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="CPAN.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/CPAN">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/CPAN">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/CPAN">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/CPAN">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/CPAN">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/CPAN">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/CPAN">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/CPAN">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/CPAN">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/CPAN">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/CPAN">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/CPAN">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/CPAN">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/CPAN">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/CPAN">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/CPAN">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/CPAN">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/CPAN">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/CPAN">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/CPAN">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/CPAN">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/CPAN">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/CPAN">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/CPAN">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/CPAN">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/CPAN">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/CPAN">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/CPAN">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/CPAN">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/CPAN">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/CPAN">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/CPAN">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/CPAN">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/CPAN">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/CPAN">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/CPAN">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/CPAN">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/CPAN">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/CPAN">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/CPAN">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/CPAN">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/CPAN">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/CPAN">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/CPAN">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/CPAN">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/CPAN">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/CPAN">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/CPAN">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/CPAN">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/CPAN">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/CPAN">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/CPAN">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/CPAN">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/CPAN">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/CPAN">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/CPAN">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/CPAN">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/CPAN">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/CPAN">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/CPAN">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/CPAN">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/CPAN">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/CPAN">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/CPAN">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/CPAN">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/CPAN">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/CPAN">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/CPAN">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/CPAN">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/CPAN">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/CPAN">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/CPAN">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/CPAN">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/CPAN">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/CPAN">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/CPAN">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/CPAN">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/CPAN">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/CPAN">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/CPAN">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="CPAN.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/CPAN">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/CPAN">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/CPAN">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/CPAN">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/CPAN">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/CPAN">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/CPAN">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/CPAN">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/CPAN">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/CPAN">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/CPAN">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/CPAN">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/CPAN">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/CPAN">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/CPAN">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/CPAN">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/CPAN">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/CPAN">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/CPAN">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/CPAN">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/CPAN">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/CPAN">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/CPAN">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/CPAN">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/CPAN">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/CPAN">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/CPAN">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/CPAN">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/CPAN">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/CPAN">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/CPAN">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/CPAN">5.35.1</a>
          <a class="dropdown-item active" href="CPAN.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="CPAN.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="CPAN.html">CPAN</a>
          <div id="more">
            (<a href="CPAN.txt">source</a>,
            <a href="https://metacpan.org/pod/CPAN">CPAN</a>)
          </div>
            <div id="moduleversion">version 2.28</div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="CPAN.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#SYNOPSIS">SYNOPSIS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#DESCRIPTION">DESCRIPTION</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="CPAN.html#CPAN::shell(%5B$prompt,-$command%5D)-Starting-Interactive-Mode">CPAN::shell([$prompt, $command]) Starting Interactive Mode</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#CPAN::Shell">CPAN::Shell</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#autobundle">autobundle</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#hosts">hosts</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#mkmyconfig">mkmyconfig</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#r-%5BModule%7C/Regexp/%5D...">r [Module|/Regexp/]...</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#recent-***EXPERIMENTAL-COMMAND***">recent ***EXPERIMENTAL COMMAND***</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#recompile">recompile</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#report-Bundle%7CDistribution%7CModule">report Bundle|Distribution|Module</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#smoke-***EXPERIMENTAL-COMMAND***">smoke ***EXPERIMENTAL COMMAND***</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#upgrade-%5BModule%7C/Regexp/%5D...">upgrade [Module|/Regexp/]...</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#The-four-CPAN::*-Classes:-Author,-Bundle,-Module,-Distribution">The four CPAN::* Classes: Author, Bundle, Module, Distribution</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Integrating-local-directories">Integrating local directories</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Redirection">Redirection</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Plugin-support-***EXPERIMENTAL***">Plugin support ***EXPERIMENTAL***</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#CONFIGURATION">CONFIGURATION</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Config-Variables">Config Variables</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#CPAN::anycwd($path):-Note-on-config-variable-getcwd">CPAN::anycwd($path): Note on config variable getcwd</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Note-on-the-format-of-the-urllist-parameter">Note on the format of the urllist parameter</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#The-urllist-parameter-has-CD-ROM-support">The urllist parameter has CD-ROM support</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Maintaining-the-urllist-parameter">Maintaining the urllist parameter</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#The-requires-and-build_requires-dependency-declarations">The requires and build_requires dependency declarations</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Configuration-of-the-allow_installing_*-parameters">Configuration of the allow_installing_* parameters</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Configuration-for-individual-distributions-(Distroprefs)">Configuration for individual distributions (Distroprefs)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Filenames">Filenames</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Fallback-Data::Dumper-and-Storable">Fallback Data::Dumper and Storable</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Blueprint">Blueprint</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Language-Specs">Language Specs</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Processing-Instructions">Processing Instructions</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Schema-verification-with-Kwalify">Schema verification with Kwalify</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Example-Distroprefs-Files">Example Distroprefs Files</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#PROGRAMMER&#39;S-INTERFACE">PROGRAMMER&#39;S INTERFACE</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Methods-in-the-other-Classes">Methods in the other Classes</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Cache-Manager">Cache Manager</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Bundles">Bundles</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#PREREQUISITES">PREREQUISITES</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#UTILITIES">UTILITIES</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Finding-packages-and-VERSION">Finding packages and VERSION</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Debugging">Debugging</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Floppy,-Zip,-Offline-Mode">Floppy, Zip, Offline Mode</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Basic-Utilities-for-Programmers">Basic Utilities for Programmers</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#SECURITY">SECURITY</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Cryptographically-signed-modules">Cryptographically signed modules</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#EXPORT">EXPORT</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#ENVIRONMENT">ENVIRONMENT</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#POPULATE-AN-INSTALLATION-WITH-LOTS-OF-MODULES">POPULATE AN INSTALLATION WITH LOTS OF MODULES</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#WORKING-WITH-CPAN.pm-BEHIND-FIREWALLS">WORKING WITH CPAN.pm BEHIND FIREWALLS</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Three-basic-types-of-firewalls">Three basic types of firewalls</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#Configuring-lynx-or-ncftp-for-going-through-a-firewall">Configuring lynx or ncftp for going through a firewall</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#FAQ">FAQ</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#COMPATIBILITY">COMPATIBILITY</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="CPAN.html#OLD-PERL-VERSIONS">OLD PERL VERSIONS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#CPANPLUS">CPANPLUS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#CPANMINUS">CPANMINUS</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#SECURITY-ADVICE">SECURITY ADVICE</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#BUGS">BUGS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#AUTHOR">AUTHOR</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#LICENSE">LICENSE</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#TRANSLATIONS">TRANSLATIONS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="CPAN.html#SEE-ALSO">SEE ALSO</a>
              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="CPAN.html#NAME">#</a>NAME</h1>

<p>CPAN - query, download and build perl modules from CPAN sites</p>

<h1 id="SYNOPSIS"><a class="permalink" href="CPAN.html#SYNOPSIS">#</a>SYNOPSIS</h1>

<p>Interactive mode:</p>

<pre><code class="plaintext">perl -MCPAN -e shell</code></pre>

<p>--or--</p>

<pre><code class="plaintext">cpan</code></pre>

<p>Basic commands:</p>

<pre><code># Modules:

cpan&gt; install Acme::Meta                       # in the shell

CPAN::Shell-&gt;install(&quot;Acme::Meta&quot;);            # in perl

# Distributions:

cpan&gt; install NWCLARK/Acme-Meta-0.02.tar.gz    # in the shell

CPAN::Shell-&gt;
  install(&quot;NWCLARK/Acme-Meta-0.02.tar.gz&quot;);    # in perl

# module objects:

$mo = CPAN::Shell-&gt;expandany($mod);
$mo = CPAN::Shell-&gt;expand(&quot;Module&quot;,$mod);      # same thing

# distribution objects:

$do = CPAN::Shell-&gt;expand(&quot;Module&quot;,$mod)-&gt;distribution;
$do = CPAN::Shell-&gt;expandany($distro);         # same thing
$do = CPAN::Shell-&gt;expand(&quot;Distribution&quot;,
                          $distro);            # same thing</code></pre>

<h1 id="DESCRIPTION"><a class="permalink" href="CPAN.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<p>The CPAN module automates or at least simplifies the make and install of perl modules and extensions. It includes some primitive searching capabilities and knows how to use LWP, HTTP::Tiny, Net::FTP and certain external download clients to fetch distributions from the net.</p>

<p>These are fetched from one or more mirrored CPAN (Comprehensive Perl Archive Network) sites and unpacked in a dedicated directory.</p>

<p>The CPAN module also supports named and versioned <i>bundles</i> of modules. Bundles simplify handling of sets of related modules. See Bundles below.</p>

<p>The package contains a session manager and a cache manager. The session manager keeps track of what has been fetched, built, and installed in the current session. The cache manager keeps track of the disk space occupied by the make processes and deletes excess space using a simple FIFO mechanism.</p>

<p>All methods provided are accessible in a programmer style and in an interactive shell style.</p>

<h2 id="CPAN::shell([$prompt,-$command])-Starting-Interactive-Mode"><a class="permalink" href="CPAN.html#CPAN::shell(%5B$prompt,-$command%5D)-Starting-Interactive-Mode">#</a><a id="CPAN"></a><a id="CPAN::shell-prompt-command-Starting-Interactive-Mode"></a>CPAN::shell([$prompt, $command]) Starting Interactive Mode</h2>

<p>Enter interactive mode by running</p>

<pre><code class="plaintext">perl -MCPAN -e shell</code></pre>

<p>or</p>

<pre><code class="plaintext">cpan</code></pre>

<p>which puts you into a readline interface. If <code>Term::ReadKey</code> and either of <code>Term::ReadLine::Perl</code> or <code>Term::ReadLine::Gnu</code> are installed, history and command completion are supported.</p>

<p>Once at the command line, type <code>h</code> for one-page help screen; the rest should be self-explanatory.</p>

<p>The function call <code>shell</code> takes two optional arguments: one the prompt, the second the default initial command line (the latter only works if a real ReadLine interface module is installed).</p>

<p>The most common uses of the interactive modes are</p>

<dl>

<dt id="Searching-for-authors,-bundles,-distribution-files-and-modules"><a class="permalink" href="CPAN.html#Searching-for-authors,-bundles,-distribution-files-and-modules">#</a><a id="Searching"></a><a id="Searching-for-authors-bundles-distribution-files-and-modules"></a>Searching for authors, bundles, distribution files and modules</dt>
<dd>

<p>There are corresponding one-letter commands <code>a</code>, <code>b</code>, <code>d</code>, and <code>m</code> for each of the four categories and another, <code>i</code> for any of the mentioned four. Each of the four entities is implemented as a class with slightly differing methods for displaying an object.</p>

<p>Arguments to these commands are either strings exactly matching the identification string of an object, or regular expressions matched case-insensitively against various attributes of the objects. The parser only recognizes a regular expression when you enclose it with slashes.</p>

<p>The principle is that the number of objects found influences how an item is displayed. If the search finds one item, the result is displayed with the rather verbose method <code>as_string</code>, but if more than one is found, each object is displayed with the terse method <code>as_glimpse</code>.</p>

<p>Examples:</p>

<pre><code class="plaintext">cpan&gt; m Acme::MetaSyntactic
Module id = Acme::MetaSyntactic
    CPAN_USERID  BOOK (Philippe Bruhat (BooK) &lt;[...]&gt;)
    CPAN_VERSION 0.99
    CPAN_FILE    B/BO/BOOK/Acme-MetaSyntactic-0.99.tar.gz
    UPLOAD_DATE  2006-11-06
    MANPAGE      Acme::MetaSyntactic - Themed metasyntactic variables names
    INST_FILE    /usr/local/lib/perl/5.10.0/Acme/MetaSyntactic.pm
    INST_VERSION 0.99
cpan&gt; a BOOK
Author id = BOOK
    EMAIL        [...]
    FULLNAME     Philippe Bruhat (BooK)
cpan&gt; d BOOK/Acme-MetaSyntactic-0.99.tar.gz
Distribution id = B/BO/BOOK/Acme-MetaSyntactic-0.99.tar.gz
    CPAN_USERID  BOOK (Philippe Bruhat (BooK) &lt;[...]&gt;)
    CONTAINSMODS Acme::MetaSyntactic Acme::MetaSyntactic::Alias [...]
    UPLOAD_DATE  2006-11-06
cpan&gt; m /lorem/
Module  = Acme::MetaSyntactic::loremipsum (BOOK/Acme-MetaSyntactic-0.99.tar.gz)
Module    Text::Lorem            (ADEOLA/Text-Lorem-0.3.tar.gz)
Module    Text::Lorem::More      (RKRIMEN/Text-Lorem-More-0.12.tar.gz)
Module    Text::Lorem::More::Source (RKRIMEN/Text-Lorem-More-0.12.tar.gz)
cpan&gt; i /berlin/
Distribution    BEATNIK/Filter-NumberLines-0.02.tar.gz
Module  = DateTime::TimeZone::Europe::Berlin (DROLSKY/DateTime-TimeZone-0.7904.tar.gz)
Module    Filter::NumberLines    (BEATNIK/Filter-NumberLines-0.02.tar.gz)
Author          [...]</code></pre>

<p>The examples illustrate several aspects: the first three queries target modules, authors, or distros directly and yield exactly one result. The last two use regular expressions and yield several results. The last one targets all of bundles, modules, authors, and distros simultaneously. When more than one result is available, they are printed in one-line format.</p>

</dd>
<dt id="get,-make,-test,-install,-clean-modules-or-distributions"><a class="permalink" href="CPAN.html#get,-make,-test,-install,-clean-modules-or-distributions">#</a><a id="get"></a><a id="get-make-test-install-clean-modules-or-distributions"></a><code>get</code>, <code>make</code>, <code>test</code>, <code>install</code>, <code>clean</code> modules or distributions</dt>
<dd>

<p>These commands take any number of arguments and investigate what is necessary to perform the action. Argument processing is as follows:</p>

<pre><code class="plaintext">known module name in format Foo/Bar.pm   module
other embedded slash                     distribution
  - with trailing slash dot              directory
enclosing slashes                        regexp
known module name in format Foo::Bar     module</code></pre>

<p>If the argument is a distribution file name (recognized by embedded slashes), it is processed. If it is a module, CPAN determines the distribution file in which this module is included and processes that, following any dependencies named in the module&#39;s META.yml or Makefile.PL (this behavior is controlled by the configuration parameter <code>prerequisites_policy</code>). If an argument is enclosed in slashes it is treated as a regular expression: it is expanded and if the result is a single object (distribution, bundle or module), this object is processed.</p>

<p>Example:</p>

<pre><code class="plaintext">install Dummy::Perl                   # installs the module
install AUXXX/Dummy-Perl-3.14.tar.gz  # installs that distribution
install /Dummy-Perl-3.14/             # same if the regexp is unambiguous</code></pre>

<p><code>get</code> downloads a distribution file and untars or unzips it, <code>make</code> builds it, <code>test</code> runs the test suite, and <code>install</code> installs it.</p>

<p>Any <code>make</code> or <code>test</code> is run unconditionally. An</p>

<pre><code class="plaintext">install &lt;distribution_file&gt;</code></pre>

<p>is also run unconditionally. But for</p>

<pre><code class="plaintext">install &lt;module&gt;</code></pre>

<p>CPAN checks whether an install is needed and prints <i>module up to date</i> if the distribution file containing the module doesn&#39;t need updating.</p>

<p>CPAN also keeps track of what it has done within the current session and doesn&#39;t try to build a package a second time regardless of whether it succeeded or not. It does not repeat a test run if the test has been run successfully before. Same for install runs.</p>

<p>The <code>force</code> pragma may precede another command (currently: <code>get</code>, <code>make</code>, <code>test</code>, or <code>install</code>) to execute the command from scratch and attempt to continue past certain errors. See the section below on the <code>force</code> and the <code>fforce</code> pragma.</p>

<p>The <code>notest</code> pragma skips the test part in the build process.</p>

<p>Example:</p>

<pre><code class="plaintext">cpan&gt; notest install Tk</code></pre>

<p>A <code>clean</code> command results in a</p>

<pre><code class="plaintext">make clean</code></pre>

<p>being executed within the distribution file&#39;s working directory.</p>

</dd>
<dt id="readme,-perldoc,-look-module-or-distribution"><a class="permalink" href="CPAN.html#readme,-perldoc,-look-module-or-distribution">#</a><a id="readme"></a><a id="readme-perldoc-look-module-or-distribution"></a><code>readme</code>, <code>perldoc</code>, <code>look</code> module or distribution</dt>
<dd>

<p><code>readme</code> displays the README file of the associated distribution. <code>Look</code> gets and untars (if not yet done) the distribution file, changes to the appropriate directory and opens a subshell process in that directory. <code>perldoc</code> displays the module&#39;s pod documentation in html or plain text format.</p>

</dd>
<dt id="ls-author"><a class="permalink" href="CPAN.html#ls-author">#</a><a id="ls"></a><code>ls</code> author</dt>
<dd>

</dd>
<dt id="ls-globbing_expression"><a class="permalink" href="CPAN.html#ls-globbing_expression">#</a><a id="ls1"></a><code>ls</code> globbing_expression</dt>
<dd>

<p>The first form lists all distribution files in and below an author&#39;s CPAN directory as stored in the CHECKSUMS files distributed on CPAN. The listing recurses into subdirectories.</p>

<p>The second form limits or expands the output with shell globbing as in the following examples:</p>

<pre><code class="plaintext">ls JV/make*
ls GSAR/*make*
ls */*make*</code></pre>

<p>The last example is very slow and outputs extra progress indicators that break the alignment of the result.</p>

<p>Note that globbing only lists directories explicitly asked for, for example FOO/* will not list FOO/bar/Acme-Sthg-n.nn.tar.gz. This may be regarded as a bug that may be changed in some future version.</p>

</dd>
<dt id="failed"><a class="permalink" href="CPAN.html#failed">#</a><code>failed</code></dt>
<dd>

<p>The <code>failed</code> command reports all distributions that failed on one of <code>make</code>, <code>test</code> or <code>install</code> for some reason in the currently running shell session.</p>

</dd>
<dt id="Persistence-between-sessions"><a class="permalink" href="CPAN.html#Persistence-between-sessions">#</a><a id="Persistence"></a>Persistence between sessions</dt>
<dd>

<p>If the <code>YAML</code> or the <code>YAML::Syck</code> module is installed a record of the internal state of all modules is written to disk after each step. The files contain a signature of the currently running perl version for later perusal.</p>

<p>If the configurations variable <code>build_dir_reuse</code> is set to a true value, then CPAN.pm reads the collected YAML files. If the stored signature matches the currently running perl, the stored state is loaded into memory such that persistence between sessions is effectively established.</p>

</dd>
<dt id="The-force-and-the-fforce-pragma"><a class="permalink" href="CPAN.html#The-force-and-the-fforce-pragma">#</a><a id="The"></a>The <code>force</code> and the <code>fforce</code> pragma</dt>
<dd>

<p>To speed things up in complex installation scenarios, CPAN.pm keeps track of what it has already done and refuses to do some things a second time. A <code>get</code>, a <code>make</code>, and an <code>install</code> are not repeated. A <code>test</code> is repeated only if the previous test was unsuccessful. The diagnostic message when CPAN.pm refuses to do something a second time is one of <i>Has already been </i><code>unwrapped|made|tested successfully</code> or something similar. Another situation where CPAN refuses to act is an <code>install</code> if the corresponding <code>test</code> was not successful.</p>

<p>In all these cases, the user can override this stubborn behaviour by prepending the command with the word force, for example:</p>

<pre><code class="plaintext">cpan&gt; force get Foo
cpan&gt; force make AUTHOR/Bar-3.14.tar.gz
cpan&gt; force test Baz
cpan&gt; force install Acme::Meta</code></pre>

<p>Each <i>forced</i> command is executed with the corresponding part of its memory erased.</p>

<p>The <code>fforce</code> pragma is a variant that emulates a <code>force get</code> which erases the entire memory followed by the action specified, effectively restarting the whole get/make/test/install procedure from scratch.</p>

</dd>
<dt id="Lockfile"><a class="permalink" href="CPAN.html#Lockfile">#</a>Lockfile</dt>
<dd>

<p>Interactive sessions maintain a lockfile, by default <code>~/.cpan/.lock</code>. Batch jobs can run without a lockfile and not disturb each other.</p>

<p>The shell offers to run in <i>downgraded mode</i> when another process is holding the lockfile. This is an experimental feature that is not yet tested very well. This second shell then does not write the history file, does not use the metadata file, and has a different prompt.</p>

</dd>
<dt id="Signals"><a class="permalink" href="CPAN.html#Signals">#</a>Signals</dt>
<dd>

<p>CPAN.pm installs signal handlers for SIGINT and SIGTERM. While you are in the cpan-shell, it is intended that you can press <code>^C</code> anytime and return to the cpan-shell prompt. A SIGTERM will cause the cpan-shell to clean up and leave the shell loop. You can emulate the effect of a SIGTERM by sending two consecutive SIGINTs, which usually means by pressing <code>^C</code> twice.</p>

<p>CPAN.pm ignores SIGPIPE. If the user sets <code>inactivity_timeout</code>, a SIGALRM is used during the run of the <code>perl Makefile.PL</code> or <code>perl Build.PL</code> subprocess. A SIGALRM is also used during module version parsing, and is controlled by <code>version_timeout</code>.</p>

</dd>
</dl>

<h2 id="CPAN::Shell"><a class="permalink" href="CPAN.html#CPAN::Shell">#</a><a id="CPAN1"></a>CPAN::Shell</h2>

<p>The commands available in the shell interface are methods in the package CPAN::Shell. If you enter the shell command, your input is split by the Text::ParseWords::shellwords() routine, which acts like most shells do. The first word is interpreted as the method to be invoked, and the rest of the words are treated as the method&#39;s arguments. Continuation lines are supported by ending a line with a literal backslash.</p>

<h2 id="autobundle"><a class="permalink" href="CPAN.html#autobundle">#</a>autobundle</h2>

<p><code>autobundle</code> writes a bundle file into the <code>$CPAN::Config-&gt;{cpan_home}/Bundle</code> directory. The file contains a list of all modules that are both available from CPAN and currently installed within @INC. Duplicates of each distribution are suppressed. The name of the bundle file is based on the current date and a counter, e.g. <i>Bundle/Snapshot_2012_05_21_00.pm</i>. This is installed again by running <code>cpan Bundle::Snapshot_2012_05_21_00</code>, or installing <code>Bundle::Snapshot_2012_05_21_00</code> from the CPAN shell.</p>

<p>Return value: path to the written file.</p>

<h2 id="hosts"><a class="permalink" href="CPAN.html#hosts">#</a>hosts</h2>

<p>Note: this feature is still in alpha state and may change in future versions of CPAN.pm</p>

<p>This commands provides a statistical overview over recent download activities. The data for this is collected in the YAML file <code>FTPstats.yml</code> in your <code>cpan_home</code> directory. If no YAML module is configured or YAML not installed, no stats are provided.</p>

<dl>

<dt id="install_tested"><a class="permalink" href="CPAN.html#install_tested">#</a>install_tested</dt>
<dd>

<p>Install all distributions that have been tested successfully but have not yet been installed. See also <code>is_tested</code>.</p>

</dd>
<dt id="is_tested"><a class="permalink" href="CPAN.html#is_tested">#</a>is_tested</dt>
<dd>

<p>List all build directories of distributions that have been tested successfully but have not yet been installed. See also <code>install_tested</code>.</p>

</dd>
</dl>

<h2 id="mkmyconfig"><a class="permalink" href="CPAN.html#mkmyconfig">#</a>mkmyconfig</h2>

<p>mkmyconfig() writes your own CPAN::MyConfig file into your <code>~/.cpan/</code> directory so that you can save your own preferences instead of the system-wide ones.</p>

<h2 id="r-[Module|/Regexp/]..."><a class="permalink" href="CPAN.html#r-%5BModule%7C/Regexp/%5D...">#</a><a id="r"></a><a id="r-Module-Regexp"></a>r [Module|/Regexp/]...</h2>

<p>scans current perl installation for modules that have a newer version available on CPAN and provides a list of them. If called without argument, all potential upgrades are listed; if called with arguments the list is filtered to the modules and regexps given as arguments.</p>

<p>The listing looks something like this:</p>

<pre><code class="plaintext">Package namespace         installed    latest  in CPAN file
CPAN                        1.94_64    1.9600  ANDK/CPAN-1.9600.tar.gz
CPAN::Reporter               1.1801    1.1902  DAGOLDEN/CPAN-Reporter-1.1902.tar.gz
YAML                           0.70      0.73  INGY/YAML-0.73.tar.gz
YAML::Syck                     1.14      1.17  AVAR/YAML-Syck-1.17.tar.gz
YAML::Tiny                     1.44      1.50  ADAMK/YAML-Tiny-1.50.tar.gz
CGI                            3.43      3.55  MARKSTOS/CGI.pm-3.55.tar.gz
Module::Build::YAML            1.40      1.41  DAGOLDEN/Module-Build-0.3800.tar.gz
TAP::Parser::Result::YAML      3.22      3.23  ANDYA/Test-Harness-3.23.tar.gz
YAML::XS                       0.34      0.35  INGY/YAML-LibYAML-0.35.tar.gz</code></pre>

<p>It suppresses duplicates in the column <code>in CPAN file</code> such that distributions with many upgradeable modules are listed only once.</p>

<p>Note that the list is not sorted.</p>

<h2 id="recent-***EXPERIMENTAL-COMMAND***"><a class="permalink" href="CPAN.html#recent-***EXPERIMENTAL-COMMAND***">#</a><a id="recent"></a><a id="recent-EXPERIMENTAL-COMMAND"></a>recent ***EXPERIMENTAL COMMAND***</h2>

<p>The <code>recent</code> command downloads a list of recent uploads to CPAN and displays them <i>slowly</i>. While the command is running, a $SIG{INT} exits the loop after displaying the current item.</p>

<p><b>Note</b>: This command requires XML::LibXML installed.</p>

<p><b>Note</b>: This whole command currently is just a hack and will probably change in future versions of CPAN.pm, but the general approach will likely remain.</p>

<p><b>Note</b>: See also <a href="https://perldoc.perl.org/5.35.0/smoke">smoke</a></p>

<h2 id="recompile"><a class="permalink" href="CPAN.html#recompile">#</a>recompile</h2>

<p>recompile() is a special command that takes no argument and runs the make/test/install cycle with brute force over all installed dynamically loadable extensions (a.k.a. XS modules) with &#39;force&#39; in effect. The primary purpose of this command is to finish a network installation. Imagine you have a common source tree for two different architectures. You decide to do a completely independent fresh installation. You start on one architecture with the help of a Bundle file produced earlier. CPAN installs the whole Bundle for you, but when you try to repeat the job on the second architecture, CPAN responds with a <code>&quot;Foo up to date&quot;</code> message for all modules. So you invoke CPAN&#39;s recompile on the second architecture and you&#39;re done.</p>

<p>Another popular use for <code>recompile</code> is to act as a rescue in case your perl breaks binary compatibility. If one of the modules that CPAN uses is in turn depending on binary compatibility (so you cannot run CPAN commands), then you should try the CPAN::Nox module for recovery.</p>

<h2 id="report-Bundle|Distribution|Module"><a class="permalink" href="CPAN.html#report-Bundle%7CDistribution%7CModule">#</a><a id="report"></a><a id="report-Bundle-Distribution-Module"></a>report Bundle|Distribution|Module</h2>

<p>The <code>report</code> command temporarily turns on the <code>test_report</code> config variable, then runs the <code>force test</code> command with the given arguments. The <code>force</code> pragma reruns the tests and repeats every step that might have failed before.</p>

<h2 id="smoke-***EXPERIMENTAL-COMMAND***"><a class="permalink" href="CPAN.html#smoke-***EXPERIMENTAL-COMMAND***">#</a><a id="smoke"></a><a id="smoke-EXPERIMENTAL-COMMAND"></a>smoke ***EXPERIMENTAL COMMAND***</h2>

<p><b>*** WARNING: this command downloads and executes software from CPAN to your computer of completely unknown status. You should never do this with your normal account and better have a dedicated well separated and secured machine to do this. ***</b></p>

<p>The <code>smoke</code> command takes the list of recent uploads to CPAN as provided by the <code>recent</code> command and tests them all. While the command is running $SIG{INT} is defined to mean that the current item shall be skipped.</p>

<p><b>Note</b>: This whole command currently is just a hack and will probably change in future versions of CPAN.pm, but the general approach will likely remain.</p>

<p><b>Note</b>: See also <a href="https://perldoc.perl.org/5.35.0/recent">recent</a></p>

<h2 id="upgrade-[Module|/Regexp/]..."><a class="permalink" href="CPAN.html#upgrade-%5BModule%7C/Regexp/%5D...">#</a><a id="upgrade"></a><a id="upgrade-Module-Regexp"></a>upgrade [Module|/Regexp/]...</h2>

<p>The <code>upgrade</code> command first runs an <code>r</code> command with the given arguments and then installs the newest versions of all modules that were listed by that.</p>

<h2 id="The-four-CPAN::*-Classes:-Author,-Bundle,-Module,-Distribution"><a class="permalink" href="CPAN.html#The-four-CPAN::*-Classes:-Author,-Bundle,-Module,-Distribution">#</a><a id="The1"></a><a id="The-four-CPAN::-Classes:-Author-Bundle-Module-Distribution"></a>The four <code>CPAN::*</code> Classes: Author, Bundle, Module, Distribution</h2>

<p>Although it may be considered internal, the class hierarchy does matter for both users and programmer. CPAN.pm deals with the four classes mentioned above, and those classes all share a set of methods. Classical single polymorphism is in effect. A metaclass object registers all objects of all kinds and indexes them with a string. The strings referencing objects have a separated namespace (well, not completely separated):</p>

<pre><code class="plaintext">      Namespace                         Class

words containing a &quot;/&quot; (slash)      Distribution
 words starting with Bundle::          Bundle
       everything else            Module or Author</code></pre>

<p>Modules know their associated Distribution objects. They always refer to the most recent official release. Developers may mark their releases as unstable development versions (by inserting an underscore into the module version number which will also be reflected in the distribution name when you run &#39;make dist&#39;), so the really hottest and newest distribution is not always the default. If a module Foo circulates on CPAN in both version 1.23 and 1.23_90, CPAN.pm offers a convenient way to install version 1.23 by saying</p>

<pre><code class="plaintext">install Foo</code></pre>

<p>This would install the complete distribution file (say BAR/Foo-1.23.tar.gz) with all accompanying material. But if you would like to install version 1.23_90, you need to know where the distribution file resides on CPAN relative to the authors/id/ directory. If the author is BAR, this might be BAR/Foo-1.23_90.tar.gz; so you would have to say</p>

<pre><code class="plaintext">install BAR/Foo-1.23_90.tar.gz</code></pre>

<p>The first example will be driven by an object of the class CPAN::Module, the second by an object of class CPAN::Distribution.</p>

<h2 id="Integrating-local-directories"><a class="permalink" href="CPAN.html#Integrating-local-directories">#</a><a id="Integrating"></a>Integrating local directories</h2>

<p>Note: this feature is still in alpha state and may change in future versions of CPAN.pm</p>

<p>Distribution objects are normally distributions from the CPAN, but there is a slightly degenerate case for Distribution objects, too, of projects held on the local disk. These distribution objects have the same name as the local directory and end with a dot. A dot by itself is also allowed for the current directory at the time CPAN.pm was used. All actions such as <code>make</code>, <code>test</code>, and <code>install</code> are applied directly to that directory. This gives the command <code>cpan .</code> an interesting touch: while the normal mantra of installing a CPAN module without CPAN.pm is one of</p>

<pre><code class="plaintext">perl Makefile.PL                 perl Build.PL
       ( go and get prerequisites )
make                             ./Build
make test                        ./Build test
make install                     ./Build install</code></pre>

<p>the command <code>cpan .</code> does all of this at once. It figures out which of the two mantras is appropriate, fetches and installs all prerequisites, takes care of them recursively, and finally finishes the installation of the module in the current directory, be it a CPAN module or not.</p>

<p>The typical usage case is for private modules or working copies of projects from remote repositories on the local disk.</p>

<h2 id="Redirection"><a class="permalink" href="CPAN.html#Redirection">#</a>Redirection</h2>

<p>The usual shell redirection symbols <code> | </code> and <code>&gt;</code> are recognized by the cpan shell <b>only when surrounded by whitespace</b>. So piping to pager or redirecting output into a file works somewhat as in a normal shell, with the stipulation that you must type extra spaces.</p>

<h2 id="Plugin-support-***EXPERIMENTAL***"><a class="permalink" href="CPAN.html#Plugin-support-***EXPERIMENTAL***">#</a><a id="Plugin"></a><a id="Plugin-support-EXPERIMENTAL"></a>Plugin support ***EXPERIMENTAL***</h2>

<p>Plugins are objects that implement any of currently eight methods:</p>

<pre><code class="plaintext">pre_get
post_get
pre_make
post_make
pre_test
post_test
pre_install
post_install</code></pre>

<p>The <code>plugin_list</code> configuration parameter holds a list of strings of the form</p>

<pre><code class="plaintext">Modulename=arg0,arg1,arg2,arg3,...</code></pre>

<p>eg:</p>

<pre><code class="plaintext">CPAN::Plugin::Flurb=dir,/opt/pkgs/flurb/raw,verbose,1</code></pre>

<p>At run time, each listed plugin is instantiated as a singleton object by running the equivalent of this pseudo code:</p>

<pre><code>my $plugin = &lt;string representation from config&gt;;
&lt;generate Modulename and arguments from $plugin&gt;;
my $p = $instance{$plugin} ||= Modulename-&gt;new($arg0,$arg1,...);</code></pre>

<p>The generated singletons are kept around from instantiation until the end of the shell session. &lt;plugin_list&gt; can be reconfigured at any time at run time. While the cpan shell is running, it checks all activated plugins at each of the 8 reference points listed above and runs the respective method if it is implemented for that object. The method is called with the active CPAN::Distribution object passed in as an argument.</p>

<h1 id="CONFIGURATION"><a class="permalink" href="CPAN.html#CONFIGURATION">#</a>CONFIGURATION</h1>

<p>When the CPAN module is used for the first time, a configuration dialogue tries to determine a couple of site specific options. The result of the dialog is stored in a hash reference <code> $CPAN::Config </code> in a file CPAN/Config.pm.</p>

<p>Default values defined in the CPAN/Config.pm file can be overridden in a user specific file: CPAN/MyConfig.pm. Such a file is best placed in <code>$HOME/.cpan/CPAN/MyConfig.pm</code>, because <code>$HOME/.cpan</code> is added to the search path of the CPAN module before the use() or require() statements. The mkmyconfig command writes this file for you.</p>

<p>The <code>o conf</code> command has various bells and whistles:</p>

<dl>

<dt id="completion-support"><a class="permalink" href="CPAN.html#completion-support">#</a><a id="completion"></a>completion support</dt>
<dd>

<p>If you have a ReadLine module installed, you can hit TAB at any point of the commandline and <code>o conf</code> will offer you completion for the built-in subcommands and/or config variable names.</p>

</dd>
<dt id="displaying-some-help:-o-conf-help"><a class="permalink" href="CPAN.html#displaying-some-help:-o-conf-help">#</a><a id="displaying"></a>displaying some help: o conf help</dt>
<dd>

<p>Displays a short help</p>

</dd>
<dt id="displaying-current-values:-o-conf-[KEY]"><a class="permalink" href="CPAN.html#displaying-current-values:-o-conf-%5BKEY%5D">#</a><a id="displaying1"></a><a id="displaying-current-values:-o-conf-KEY"></a>displaying current values: o conf [KEY]</dt>
<dd>

<p>Displays the current value(s) for this config variable. Without KEY, displays all subcommands and config variables.</p>

<p>Example:</p>

<pre><code class="plaintext">o conf shell</code></pre>

<p>If KEY starts and ends with a slash, the string in between is treated as a regular expression and only keys matching this regexp are displayed</p>

<p>Example:</p>

<pre><code class="plaintext">o conf /color/</code></pre>

</dd>
<dt id="changing-of-scalar-values:-o-conf-KEY-VALUE"><a class="permalink" href="CPAN.html#changing-of-scalar-values:-o-conf-KEY-VALUE">#</a><a id="changing"></a>changing of scalar values: o conf KEY VALUE</dt>
<dd>

<p>Sets the config variable KEY to VALUE. The empty string can be specified as usual in shells, with <code>&#39;&#39;</code> or <code>&quot;&quot;</code></p>

<p>Example:</p>

<pre><code class="plaintext">o conf wget /usr/bin/wget</code></pre>

</dd>
<dt id="changing-of-list-values:-o-conf-KEY-SHIFT|UNSHIFT|PUSH|POP|SPLICE|LIST"><a class="permalink" href="CPAN.html#changing-of-list-values:-o-conf-KEY-SHIFT%7CUNSHIFT%7CPUSH%7CPOP%7CSPLICE%7CLIST">#</a><a id="changing1"></a><a id="changing-of-list-values:-o-conf-KEY-SHIFT-UNSHIFT-PUSH-POP-SPLICE-LIST"></a>changing of list values: o conf KEY SHIFT|UNSHIFT|PUSH|POP|SPLICE|LIST</dt>
<dd>

<p>If a config variable name ends with <code>list</code>, it is a list. <code>o conf KEY shift</code> removes the first element of the list, <code>o conf KEY pop</code> removes the last element of the list. <code>o conf KEYS unshift LIST</code> prepends a list of values to the list, <code>o conf KEYS push LIST</code> appends a list of valued to the list.</p>

<p>Likewise, <code>o conf KEY splice LIST</code> passes the LIST to the corresponding splice command.</p>

<p>Finally, any other list of arguments is taken as a new list value for the KEY variable discarding the previous value.</p>

<p>Examples:</p>

<pre><code class="plaintext">o conf urllist unshift http://cpan.dev.local/CPAN
o conf urllist splice 3 1
o conf urllist http://cpan1.local http://cpan2.local ftp://ftp.perl.org</code></pre>

</dd>
<dt id="reverting-to-saved:-o-conf-defaults"><a class="permalink" href="CPAN.html#reverting-to-saved:-o-conf-defaults">#</a><a id="reverting"></a>reverting to saved: o conf defaults</dt>
<dd>

<p>Reverts all config variables to the state in the saved config file.</p>

</dd>
<dt id="saving-the-config:-o-conf-commit"><a class="permalink" href="CPAN.html#saving-the-config:-o-conf-commit">#</a><a id="saving"></a>saving the config: o conf commit</dt>
<dd>

<p>Saves all config variables to the current config file (CPAN/Config.pm or CPAN/MyConfig.pm that was loaded at start).</p>

</dd>
</dl>

<p>The configuration dialog can be started any time later again by issuing the command <code> o conf init </code> in the CPAN shell. A subset of the configuration dialog can be run by issuing <code>o conf init WORD</code> where WORD is any valid config variable or a regular expression.</p>

<h2 id="Config-Variables"><a class="permalink" href="CPAN.html#Config-Variables">#</a><a id="Config"></a>Config Variables</h2>

<p>The following keys in the hash reference $CPAN::Config are currently defined:</p>

<pre><code class="nohighlight">allow_installing_module_downgrades
                   allow or disallow installing module downgrades
allow_installing_outdated_dists
                   allow or disallow installing modules that are
                   indexed in the cpan index pointing to a distro
                   with a higher distro-version number
applypatch         path to external prg
auto_commit        commit all changes to config variables to disk
build_cache        size of cache for directories to build modules
build_dir          locally accessible directory to build modules
build_dir_reuse    boolean if distros in build_dir are persistent
build_requires_install_policy
                   to install or not to install when a module is
                   only needed for building. yes|no|ask/yes|ask/no
bzip2              path to external prg
cache_metadata     use serializer to cache metadata
check_sigs         if signatures should be verified
cleanup_after_install
                   remove build directory immediately after a
                   successful install and remember that for the
                   duration of the session
colorize_debug     Term::ANSIColor attributes for debugging output
colorize_output    boolean if Term::ANSIColor should colorize output
colorize_print     Term::ANSIColor attributes for normal output
colorize_warn      Term::ANSIColor attributes for warnings
commandnumber_in_prompt
                   boolean if you want to see current command number
commands_quote     preferred character to use for quoting external
                   commands when running them. Defaults to double
                   quote on Windows, single tick everywhere else;
                   can be set to space to disable quoting
connect_to_internet_ok
                   whether to ask if opening a connection is ok before
                   urllist is specified
cpan_home          local directory reserved for this package
curl               path to external prg
dontload_hash      DEPRECATED
dontload_list      arrayref: modules in the list will not be
                   loaded by the CPAN::has_inst() routine
ftp                path to external prg
ftp_passive        if set, the environment variable FTP_PASSIVE is set
                   for downloads
ftp_proxy          proxy host for ftp requests
ftpstats_period    max number of days to keep download statistics
ftpstats_size      max number of items to keep in the download statistics
getcwd             see below
gpg                path to external prg
gzip               location of external program gzip
halt_on_failure    stop processing after the first failure of queued
                   items or dependencies
histfile           file to maintain history between sessions
histsize           maximum number of lines to keep in histfile
http_proxy         proxy host for http requests
inactivity_timeout breaks interactive Makefile.PLs or Build.PLs
                   after this many seconds inactivity. Set to 0 to
                   disable timeouts.
index_expire       refetch index files after this many days
inhibit_startup_message
                   if true, suppress the startup message
keep_source_where  directory in which to keep the source (if we do)
load_module_verbosity
                   report loading of optional modules used by CPAN.pm
lynx               path to external prg
make               location of external make program
make_arg           arguments that should always be passed to &#39;make&#39;
make_install_make_command
                   the make command for running &#39;make install&#39;, for
                   example &#39;sudo make&#39;
make_install_arg   same as make_arg for &#39;make install&#39;
makepl_arg         arguments passed to &#39;perl Makefile.PL&#39;
mbuild_arg         arguments passed to &#39;./Build&#39;
mbuild_install_arg arguments passed to &#39;./Build install&#39;
mbuild_install_build_command
                   command to use instead of &#39;./Build&#39; when we are
                   in the install stage, for example &#39;sudo ./Build&#39;
mbuildpl_arg       arguments passed to &#39;perl Build.PL&#39;
ncftp              path to external prg
ncftpget           path to external prg
no_proxy           don&#39;t proxy to these hosts/domains (comma separated list)
pager              location of external program more (or any pager)
password           your password if you CPAN server wants one
patch              path to external prg
patches_dir        local directory containing patch files
perl5lib_verbosity verbosity level for PERL5LIB additions
plugin_list        list of active hooks (see Plugin support above
                   and the CPAN::Plugin module)
prefer_external_tar
                   per default all untar operations are done with
                   Archive::Tar; by setting this variable to true
                   the external tar command is used if available
prefer_installer   legal values are MB and EUMM: if a module comes
                   with both a Makefile.PL and a Build.PL, use the
                   former (EUMM) or the latter (MB); if the module
                   comes with only one of the two, that one will be
                   used no matter the setting
prerequisites_policy
                   what to do if you are missing module prerequisites
                   (&#39;follow&#39; automatically, &#39;ask&#39; me, or &#39;ignore&#39;)
                   For &#39;follow&#39;, also sets PERL_AUTOINSTALL and
                   PERL_EXTUTILS_AUTOINSTALL for &quot;--defaultdeps&quot; if
                   not already set
prefs_dir          local directory to store per-distro build options
proxy_user         username for accessing an authenticating proxy
proxy_pass         password for accessing an authenticating proxy
randomize_urllist  add some randomness to the sequence of the urllist
recommends_policy  whether recommended prerequisites should be included
scan_cache         controls scanning of cache (&#39;atstart&#39;, &#39;atexit&#39; or &#39;never&#39;)
shell              your favorite shell
show_unparsable_versions
                   boolean if r command tells which modules are versionless
show_upload_date   boolean if commands should try to determine upload date
show_zero_versions boolean if r command tells for which modules $version==0
suggests_policy    whether suggested prerequisites should be included
tar                location of external program tar
tar_verbosity      verbosity level for the tar command
term_is_latin      deprecated: if true Unicode is translated to ISO-8859-1
                   (and nonsense for characters outside latin range)
term_ornaments     boolean to turn ReadLine ornamenting on/off
test_report        email test reports (if CPAN::Reporter is installed)
trust_test_report_history
                   skip testing when previously tested ok (according to
                   CPAN::Reporter history)
unzip              location of external program unzip
urllist            arrayref to nearby CPAN sites (or equivalent locations)
urllist_ping_external
                   use external ping command when autoselecting mirrors
urllist_ping_verbose
                   increase verbosity when autoselecting mirrors
use_prompt_default set PERL_MM_USE_DEFAULT for configure/make/test/install
use_sqlite         use CPAN::SQLite for metadata storage (fast and lean)
username           your username if you CPAN server wants one
version_timeout    stops version parsing after this many seconds.
                   Default is 15 secs. Set to 0 to disable.
wait_list          arrayref to a wait server to try (See CPAN::WAIT)
wget               path to external prg
yaml_load_code     enable YAML code deserialisation via CPAN::DeferredCode
yaml_module        which module to use to read/write YAML files</code></pre>

<p>You can set and query each of these options interactively in the cpan shell with the <code>o conf</code> or the <code>o conf init</code> command as specified below.</p>

<dl>

<dt id="o-conf"><a class="permalink" href="CPAN.html#o-conf">#</a><a id="o-conf-&lt;scalar-option&gt;"></a><a id="o"></a><a id="o-conf-scalar-option"></a><code>o conf &lt;scalar option&gt;</code></dt>
<dd>

<p>prints the current value of the <i>scalar option</i></p>

</dd>
<dt id="o-conf1"><a class="permalink" href="CPAN.html#o-conf1">#</a><a id="o-conf-&lt;scalar-option&gt;-&lt;value&gt;"></a><a id="o1"></a><a id="o-conf-scalar-option-value"></a><code>o conf &lt;scalar option&gt; &lt;value&gt;</code></dt>
<dd>

<p>Sets the value of the <i>scalar option</i> to <i>value</i></p>

</dd>
<dt id="o-conf2"><a class="permalink" href="CPAN.html#o-conf2">#</a><a id="o-conf-&lt;list-option&gt;"></a><a id="o2"></a><a id="o-conf-list-option"></a><code>o conf &lt;list option&gt;</code></dt>
<dd>

<p>prints the current value of the <i>list option</i> in MakeMaker&#39;s neatvalue format.</p>

</dd>
<dt id="o-conf-[shift|pop]"><a class="permalink" href="CPAN.html#o-conf-%5Bshift%7Cpop%5D">#</a><a id="o-conf-&lt;list-option&gt;-[shift|pop]"></a><a id="o3"></a><a id="o-conf-list-option-shift-pop"></a><code>o conf &lt;list option&gt; [shift|pop]</code></dt>
<dd>

<p>shifts or pops the array in the <i>list option</i> variable</p>

</dd>
<dt id="o-conf-[unshift|push|splice]"><a class="permalink" href="CPAN.html#o-conf-%5Bunshift%7Cpush%7Csplice%5D">#</a><a id="o-conf-&lt;list-option&gt;-[unshift|push|splice]-&lt;list&gt;"></a><a id="o4"></a><a id="o-conf-list-option-unshift-push-splice-list"></a><code>o conf &lt;list option&gt; [unshift|push|splice] &lt;list&gt;</code></dt>
<dd>

<p>works like the corresponding perl commands.</p>

</dd>
<dt id="interactive-editing:-o-conf-init-[MATCH|LIST]"><a class="permalink" href="CPAN.html#interactive-editing:-o-conf-init-%5BMATCH%7CLIST%5D">#</a><a id="interactive"></a><a id="interactive-editing:-o-conf-init-MATCH-LIST"></a>interactive editing: o conf init [MATCH|LIST]</dt>
<dd>

<p>Runs an interactive configuration dialog for matching variables. Without argument runs the dialog over all supported config variables. To specify a MATCH the argument must be enclosed by slashes.</p>

<p>Examples:</p>

<pre><code class="plaintext">o conf init ftp_passive ftp_proxy
o conf init /color/</code></pre>

<p>Note: this method of setting config variables often provides more explanation about the functioning of a variable than the manpage.</p>

</dd>
</dl>

<h2 id="CPAN::anycwd($path):-Note-on-config-variable-getcwd"><a class="permalink" href="CPAN.html#CPAN::anycwd($path):-Note-on-config-variable-getcwd">#</a><a id="CPAN2"></a><a id="CPAN::anycwd-path-:-Note-on-config-variable-getcwd"></a>CPAN::anycwd($path): Note on config variable getcwd</h2>

<p>CPAN.pm changes the current working directory often and needs to determine its own current working directory. By default it uses Cwd::cwd, but if for some reason this doesn&#39;t work on your system, configure alternatives according to the following table:</p>

<dl>

<dt id="cwd"><a class="permalink" href="CPAN.html#cwd">#</a>cwd</dt>
<dd>

<p>Calls Cwd::cwd</p>

</dd>
<dt id="getcwd"><a class="permalink" href="CPAN.html#getcwd">#</a>getcwd</dt>
<dd>

<p>Calls Cwd::getcwd</p>

</dd>
<dt id="fastcwd"><a class="permalink" href="CPAN.html#fastcwd">#</a>fastcwd</dt>
<dd>

<p>Calls Cwd::fastcwd</p>

</dd>
<dt id="getdcwd"><a class="permalink" href="CPAN.html#getdcwd">#</a>getdcwd</dt>
<dd>

<p>Calls Cwd::getdcwd</p>

</dd>
<dt id="backtickcwd"><a class="permalink" href="CPAN.html#backtickcwd">#</a>backtickcwd</dt>
<dd>

<p>Calls the external command cwd.</p>

</dd>
</dl>

<h2 id="Note-on-the-format-of-the-urllist-parameter"><a class="permalink" href="CPAN.html#Note-on-the-format-of-the-urllist-parameter">#</a><a id="Note"></a>Note on the format of the urllist parameter</h2>

<p>urllist parameters are URLs according to RFC 1738. We do a little guessing if your URL is not compliant, but if you have problems with <code>file</code> URLs, please try the correct format. Either:</p>

<pre><code class="plaintext">file://localhost/whatever/ftp/pub/CPAN/</code></pre>

<p>or</p>

<pre><code class="plaintext">file:///home/ftp/pub/CPAN/</code></pre>

<h2 id="The-urllist-parameter-has-CD-ROM-support"><a class="permalink" href="CPAN.html#The-urllist-parameter-has-CD-ROM-support">#</a><a id="The2"></a>The urllist parameter has CD-ROM support</h2>

<p>The <code>urllist</code> parameter of the configuration table contains a list of URLs used for downloading. If the list contains any <code>file</code> URLs, CPAN always tries there first. This feature is disabled for index files. So the recommendation for the owner of a CD-ROM with CPAN contents is: include your local, possibly outdated CD-ROM as a <code>file</code> URL at the end of urllist, e.g.</p>

<pre><code class="plaintext">o conf urllist push file://localhost/CDROM/CPAN</code></pre>

<p>CPAN.pm will then fetch the index files from one of the CPAN sites that come at the beginning of urllist. It will later check for each module to see whether there is a local copy of the most recent version.</p>

<p>Another peculiarity of urllist is that the site that we could successfully fetch the last file from automatically gets a preference token and is tried as the first site for the next request. So if you add a new site at runtime it may happen that the previously preferred site will be tried another time. This means that if you want to disallow a site for the next transfer, it must be explicitly removed from urllist.</p>

<h2 id="Maintaining-the-urllist-parameter"><a class="permalink" href="CPAN.html#Maintaining-the-urllist-parameter">#</a><a id="Maintaining"></a>Maintaining the urllist parameter</h2>

<p>If you have YAML.pm (or some other YAML module configured in <code>yaml_module</code>) installed, CPAN.pm collects a few statistical data about recent downloads. You can view the statistics with the <code>hosts</code> command or inspect them directly by looking into the <code>FTPstats.yml</code> file in your <code>cpan_home</code> directory.</p>

<p>To get some interesting statistics, it is recommended that <code>randomize_urllist</code> be set; this introduces some amount of randomness into the URL selection.</p>

<h2 id="The-requires-and-build_requires-dependency-declarations"><a class="permalink" href="CPAN.html#The-requires-and-build_requires-dependency-declarations">#</a><a id="The3"></a>The <code>requires</code> and <code>build_requires</code> dependency declarations</h2>

<p>Since CPAN.pm version 1.88_51 modules declared as <code>build_requires</code> by a distribution are treated differently depending on the config variable <code>build_requires_install_policy</code>. By setting <code>build_requires_install_policy</code> to <code>no</code>, such a module is not installed. It is only built and tested, and then kept in the list of tested but uninstalled modules. As such, it is available during the build of the dependent module by integrating the path to the <code>blib/arch</code> and <code>blib/lib</code> directories in the environment variable PERL5LIB. If <code>build_requires_install_policy</code> is set to <code>yes</code>, then both modules declared as <code>requires</code> and those declared as <code>build_requires</code> are treated alike. By setting to <code>ask/yes</code> or <code>ask/no</code>, CPAN.pm asks the user and sets the default accordingly.</p>

<h2 id="Configuration-of-the-allow_installing_*-parameters"><a class="permalink" href="CPAN.html#Configuration-of-the-allow_installing_*-parameters">#</a><a id="Configuration"></a><a id="Configuration-of-the-allow_installing_-parameters"></a>Configuration of the allow_installing_* parameters</h2>

<p>The <code>allow_installing_*</code> parameters are evaluated during the <code>make</code> phase. If set to <code>yes</code>, they allow the testing and the installation of the current distro and otherwise have no effect. If set to <code>no</code>, they may abort the build (preventing testing and installing), depending on the contents of the <code>blib/</code> directory. The <code>blib/</code> directory is the directory that holds all the files that would usually be installed in the <code>install</code> phase.</p>

<p><code>allow_installing_outdated_dists</code> compares the <code>blib/</code> directory with the CPAN index. If it finds something there that belongs, according to the index, to a different dist, it aborts the current build.</p>

<p><code>allow_installing_module_downgrades</code> compares the <code>blib/</code> directory with already installed modules, actually their version numbers, as determined by ExtUtils::MakeMaker or equivalent. If a to-be-installed module would downgrade an already installed module, the current build is aborted.</p>

<p>An interesting twist occurs when a distroprefs document demands the installation of an outdated dist via goto while <code>allow_installing_outdated_dists</code> forbids it. Without additional provisions, this would let the <code>allow_installing_outdated_dists</code> win and the distroprefs lose. So the proper arrangement in such a case is to write a second distroprefs document for the distro that <code>goto</code> points to and overrule the <code>cpanconfig</code> there. E.g.:</p>

<pre><code class="plaintext">---
match:
  distribution: &quot;^MAUKE/Keyword-Simple-0.04.tar.gz&quot;
goto: &quot;MAUKE/Keyword-Simple-0.03.tar.gz&quot;
---
match:
  distribution: &quot;^MAUKE/Keyword-Simple-0.03.tar.gz&quot;
cpanconfig:
  allow_installing_outdated_dists: yes</code></pre>

<h2 id="Configuration-for-individual-distributions-(Distroprefs)"><a class="permalink" href="CPAN.html#Configuration-for-individual-distributions-(Distroprefs)">#</a><a id="Configuration1"></a><a id="Configuration-for-individual-distributions-Distroprefs"></a>Configuration for individual distributions (<i>Distroprefs</i>)</h2>

<p>(<b>Note:</b> This feature has been introduced in CPAN.pm 1.8854)</p>

<p>Distributions on CPAN usually behave according to what we call the CPAN mantra. Or since the advent of Module::Build we should talk about two mantras:</p>

<pre><code class="plaintext">perl Makefile.PL     perl Build.PL
make                 ./Build
make test            ./Build test
make install         ./Build install</code></pre>

<p>But some modules cannot be built with this mantra. They try to get some extra data from the user via the environment, extra arguments, or interactively--thus disturbing the installation of large bundles like Phalanx100 or modules with many dependencies like Plagger.</p>

<p>The distroprefs system of <code>CPAN.pm</code> addresses this problem by allowing the user to specify extra informations and recipes in YAML files to either</p>

<ul>

<li><p>pass additional arguments to one of the four commands,</p>

</li>
<li><p>set environment variables</p>

</li>
<li><p>instantiate an Expect object that reads from the console, waits for some regular expressions and enters some answers</p>

</li>
<li><p>temporarily override assorted <code>CPAN.pm</code> configuration variables</p>

</li>
<li><p>specify dependencies the original maintainer forgot</p>

</li>
<li><p>disable the installation of an object altogether</p>

</li>
</ul>

<p>See the YAML and Data::Dumper files that come with the <code>CPAN.pm</code> distribution in the <code>distroprefs/</code> directory for examples.</p>

<h2 id="Filenames"><a class="permalink" href="CPAN.html#Filenames">#</a>Filenames</h2>

<p>The YAML files themselves must have the <code>.yml</code> extension; all other files are ignored (for two exceptions see <i>Fallback Data::Dumper and Storable</i> below). The containing directory can be specified in <code>CPAN.pm</code> in the <code>prefs_dir</code> config variable. Try <code>o conf init prefs_dir</code> in the CPAN shell to set and activate the distroprefs system.</p>

<p>Every YAML file may contain arbitrary documents according to the YAML specification, and every document is treated as an entity that can specify the treatment of a single distribution.</p>

<p>Filenames can be picked arbitrarily; <code>CPAN.pm</code> always reads all files (in alphabetical order) and takes the key <code>match</code> (see below in <i>Language Specs</i>) as a hashref containing match criteria that determine if the current distribution matches the YAML document or not.</p>

<h2 id="Fallback-Data::Dumper-and-Storable"><a class="permalink" href="CPAN.html#Fallback-Data::Dumper-and-Storable">#</a><a id="Fallback"></a>Fallback Data::Dumper and Storable</h2>

<p>If neither your configured <code>yaml_module</code> nor YAML.pm is installed, CPAN.pm falls back to using Data::Dumper and Storable and looks for files with the extensions <code>.dd</code> or <code>.st</code> in the <code>prefs_dir</code> directory. These files are expected to contain one or more hashrefs. For Data::Dumper generated files, this is expected to be done with by defining <code>$VAR1</code>, <code>$VAR2</code>, etc. The YAML shell would produce these with the command</p>

<pre><code class="plaintext">ysh &lt; somefile.yml &gt; somefile.dd</code></pre>

<p>For Storable files the rule is that they must be constructed such that <code>Storable::retrieve(file)</code> returns an array reference and the array elements represent one distropref object each. The conversion from YAML would look like so:</p>

<pre><code>perl -MYAML=LoadFile -MStorable=nstore -e &#39;
    @y=LoadFile(shift);
    nstore(\@y, shift)&#39; somefile.yml somefile.st</code></pre>

<p>In bootstrapping situations it is usually sufficient to translate only a few YAML files to Data::Dumper for crucial modules like <code>YAML::Syck</code>, <code>YAML.pm</code> and <code>Expect.pm</code>. If you prefer Storable over Data::Dumper, remember to pull out a Storable version that writes an older format than all the other Storable versions that will need to read them.</p>

<h2 id="Blueprint"><a class="permalink" href="CPAN.html#Blueprint">#</a>Blueprint</h2>

<p>The following example contains all supported keywords and structures with the exception of <code>eexpect</code> which can be used instead of <code>expect</code>.</p>

<pre><code class="plaintext">---
comment: &quot;Demo&quot;
match:
  module: &quot;Dancing::Queen&quot;
  distribution: &quot;^CHACHACHA/Dancing-&quot;
  not_distribution: &quot;\.zip$&quot;
  perl: &quot;/usr/local/cariba-perl/bin/perl&quot;
  perlconfig:
    archname: &quot;freebsd&quot;
    not_cc: &quot;gcc&quot;
  env:
    DANCING_FLOOR: &quot;Shubiduh&quot;
disabled: 1
cpanconfig:
  make: gmake
pl:
  args:
    - &quot;--somearg=specialcase&quot;

  env: {}

  expect:
    - &quot;Which is your favorite fruit&quot;
    - &quot;apple\n&quot;

make:
  args:
    - all
    - extra-all

  env: {}

  expect: []

  commandline: &quot;echo SKIPPING make&quot;

test:
  args: []

  env: {}

  expect: []

install:
  args: []

  env:
    WANT_TO_INSTALL: YES

  expect:
    - &quot;Do you really want to install&quot;
    - &quot;y\n&quot;

patches:
  - &quot;ABCDE/Fedcba-3.14-ABCDE-01.patch&quot;

depends:
  configure_requires:
    LWP: 5.8
  build_requires:
    Test::Exception: 0.25
  requires:
    Spiffy: 0.30</code></pre>

<h2 id="Language-Specs"><a class="permalink" href="CPAN.html#Language-Specs">#</a><a id="Language"></a>Language Specs</h2>

<p>Every YAML document represents a single hash reference. The valid keys in this hash are as follows:</p>

<dl>

<dt id="comment-[scalar]"><a class="permalink" href="CPAN.html#comment-%5Bscalar%5D">#</a><a id="comment"></a><a id="comment-scalar"></a>comment [scalar]</dt>
<dd>

<p>A comment</p>

</dd>
<dt id="cpanconfig-[hash]"><a class="permalink" href="CPAN.html#cpanconfig-%5Bhash%5D">#</a><a id="cpanconfig"></a><a id="cpanconfig-hash"></a>cpanconfig [hash]</dt>
<dd>

<p>Temporarily override assorted <code>CPAN.pm</code> configuration variables.</p>

<p>Supported are: <code>build_requires_install_policy</code>, <code>check_sigs</code>, <code>make</code>, <code>make_install_make_command</code>, <code>prefer_installer</code>, <code>test_report</code>. Please report as a bug when you need another one supported.</p>

</dd>
<dt id="depends-[hash]-***-EXPERIMENTAL-FEATURE-***"><a class="permalink" href="CPAN.html#depends-%5Bhash%5D-***-EXPERIMENTAL-FEATURE-***">#</a><a id="depends"></a><a id="depends-hash-EXPERIMENTAL-FEATURE"></a>depends [hash] *** EXPERIMENTAL FEATURE ***</dt>
<dd>

<p>All three types, namely <code>configure_requires</code>, <code>build_requires</code>, and <code>requires</code> are supported in the way specified in the META.yml specification. The current implementation <i>merges</i> the specified dependencies with those declared by the package maintainer. In a future implementation this may be changed to override the original declaration.</p>

</dd>
<dt id="disabled-[boolean]"><a class="permalink" href="CPAN.html#disabled-%5Bboolean%5D">#</a><a id="disabled"></a><a id="disabled-boolean"></a>disabled [boolean]</dt>
<dd>

<p>Specifies that this distribution shall not be processed at all.</p>

</dd>
<dt id="features-[array]-***-EXPERIMENTAL-FEATURE-***"><a class="permalink" href="CPAN.html#features-%5Barray%5D-***-EXPERIMENTAL-FEATURE-***">#</a><a id="features"></a><a id="features-array-EXPERIMENTAL-FEATURE"></a>features [array] *** EXPERIMENTAL FEATURE ***</dt>
<dd>

<p>Experimental implementation to deal with optional_features from META.yml. Still needs coordination with installer software and currently works only for META.yml declaring <code>dynamic_config=0</code>. Use with caution.</p>

</dd>
<dt id="goto-[string]"><a class="permalink" href="CPAN.html#goto-%5Bstring%5D">#</a><a id="goto"></a><a id="goto-string"></a>goto [string]</dt>
<dd>

<p>The canonical name of a delegate distribution to install instead. Useful when a new version, although it tests OK itself, breaks something else or a developer release or a fork is already uploaded that is better than the last released version.</p>

</dd>
<dt id="install-[hash]"><a class="permalink" href="CPAN.html#install-%5Bhash%5D">#</a><a id="install"></a><a id="install-hash"></a>install [hash]</dt>
<dd>

<p>Processing instructions for the <code>make install</code> or <code>./Build install</code> phase of the CPAN mantra. See below under <i>Processing Instructions</i>.</p>

</dd>
<dt id="make-[hash]"><a class="permalink" href="CPAN.html#make-%5Bhash%5D">#</a><a id="make"></a><a id="make-hash"></a>make [hash]</dt>
<dd>

<p>Processing instructions for the <code>make</code> or <code>./Build</code> phase of the CPAN mantra. See below under <i>Processing Instructions</i>.</p>

</dd>
<dt id="match-[hash]"><a class="permalink" href="CPAN.html#match-%5Bhash%5D">#</a><a id="match"></a><a id="match-hash"></a>match [hash]</dt>
<dd>

<p>A hashref with one or more of the keys <code>distribution</code>, <code>module</code>, <code>perl</code>, <code>perlconfig</code>, and <code>env</code> that specify whether a document is targeted at a specific CPAN distribution or installation. Keys prefixed with <code>not_</code> negates the corresponding match.</p>

<p>The corresponding values are interpreted as regular expressions. The <code>distribution</code> related one will be matched against the canonical distribution name, e.g. &quot;AUTHOR/Foo-Bar-3.14.tar.gz&quot;.</p>

<p>The <code>module</code> related one will be matched against <i>all</i> modules contained in the distribution until one module matches.</p>

<p>The <code>perl</code> related one will be matched against <code>$^X</code> (but with the absolute path).</p>

<p>The value associated with <code>perlconfig</code> is itself a hashref that is matched against corresponding values in the <code>%Config::Config</code> hash living in the <code>Config.pm</code> module. Keys prefixed with <code>not_</code> negates the corresponding match.</p>

<p>The value associated with <code>env</code> is itself a hashref that is matched against corresponding values in the <code>%ENV</code> hash. Keys prefixed with <code>not_</code> negates the corresponding match.</p>

<p>If more than one restriction of <code>module</code>, <code>distribution</code>, etc. is specified, the results of the separately computed match values must all match. If so, the hashref represented by the YAML document is returned as the preference structure for the current distribution.</p>

</dd>
<dt id="patches-[array]"><a class="permalink" href="CPAN.html#patches-%5Barray%5D">#</a><a id="patches"></a><a id="patches-array"></a>patches [array]</dt>
<dd>

<p>An array of patches on CPAN or on the local disk to be applied in order via an external patch program. If the value for the <code>-p</code> parameter is <code>0</code> or <code>1</code> is determined by reading the patch beforehand. The path to each patch is either an absolute path on the local filesystem or relative to a patch directory specified in the <code>patches_dir</code> configuration variable or in the format of a canonical distro name. For examples please consult the distroprefs/ directory in the CPAN.pm distribution (these examples are not installed by default).</p>

<p>Note: if the <code>applypatch</code> program is installed and <code>CPAN::Config</code> knows about it <b>and</b> a patch is written by the <code>makepatch</code> program, then <code>CPAN.pm</code> lets <code>applypatch</code> apply the patch. Both <code>makepatch</code> and <code>applypatch</code> are available from CPAN in the <code>JV/makepatch-*</code> distribution.</p>

</dd>
<dt id="pl-[hash]"><a class="permalink" href="CPAN.html#pl-%5Bhash%5D">#</a><a id="pl"></a><a id="pl-hash"></a>pl [hash]</dt>
<dd>

<p>Processing instructions for the <code>perl Makefile.PL</code> or <code>perl Build.PL</code> phase of the CPAN mantra. See below under <i>Processing Instructions</i>.</p>

</dd>
<dt id="test-[hash]"><a class="permalink" href="CPAN.html#test-%5Bhash%5D">#</a><a id="test"></a><a id="test-hash"></a>test [hash]</dt>
<dd>

<p>Processing instructions for the <code>make test</code> or <code>./Build test</code> phase of the CPAN mantra. See below under <i>Processing Instructions</i>.</p>

</dd>
</dl>

<h2 id="Processing-Instructions"><a class="permalink" href="CPAN.html#Processing-Instructions">#</a><a id="Processing"></a>Processing Instructions</h2>

<dl>

<dt id="args-[array]"><a class="permalink" href="CPAN.html#args-%5Barray%5D">#</a><a id="args"></a><a id="args-array"></a>args [array]</dt>
<dd>

<p>Arguments to be added to the command line</p>

</dd>
<dt id="commandline"><a class="permalink" href="CPAN.html#commandline">#</a>commandline</dt>
<dd>

<p>A full commandline to run via <code>system()</code>. During execution, the environment variable PERL is set to $^X (but with an absolute path). If <code>commandline</code> is specified, <code>args</code> is not used.</p>

</dd>
<dt id="eexpect-[hash]"><a class="permalink" href="CPAN.html#eexpect-%5Bhash%5D">#</a><a id="eexpect"></a><a id="eexpect-hash"></a>eexpect [hash]</dt>
<dd>

<p>Extended <code>expect</code>. This is a hash reference with four allowed keys, <code>mode</code>, <code>timeout</code>, <code>reuse</code>, and <code>talk</code>.</p>

<p>You must install the <code>Expect</code> module to use <code>eexpect</code>. CPAN.pm does not install it for you.</p>

<p><code>mode</code> may have the values <code>deterministic</code> for the case where all questions come in the order written down and <code>anyorder</code> for the case where the questions may come in any order. The default mode is <code>deterministic</code>.</p>

<p><code>timeout</code> denotes a timeout in seconds. Floating-point timeouts are OK. With <code>mode=deterministic</code>, the timeout denotes the timeout per question; with <code>mode=anyorder</code> it denotes the timeout per byte received from the stream or questions.</p>

<p><code>talk</code> is a reference to an array that contains alternating questions and answers. Questions are regular expressions and answers are literal strings. The Expect module watches the stream from the execution of the external program (<code>perl Makefile.PL</code>, <code>perl Build.PL</code>, <code>make</code>, etc.).</p>

<p>For <code>mode=deterministic</code>, the CPAN.pm injects the corresponding answer as soon as the stream matches the regular expression.</p>

<p>For <code>mode=anyorder</code> CPAN.pm answers a question as soon as the timeout is reached for the next byte in the input stream. In this mode you can use the <code>reuse</code> parameter to decide what will happen with a question-answer pair after it has been used. In the default case (reuse=0) it is removed from the array, avoiding being used again accidentally. If you want to answer the question <code>Do you really want to do that</code> several times, then it must be included in the array at least as often as you want this answer to be given. Setting the parameter <code>reuse</code> to 1 makes this repetition unnecessary.</p>

</dd>
<dt id="env-[hash]"><a class="permalink" href="CPAN.html#env-%5Bhash%5D">#</a><a id="env"></a><a id="env-hash"></a>env [hash]</dt>
<dd>

<p>Environment variables to be set during the command</p>

</dd>
<dt id="expect-[array]"><a class="permalink" href="CPAN.html#expect-%5Barray%5D">#</a><a id="expect"></a><a id="expect-array"></a>expect [array]</dt>
<dd>

<p>You must install the <code>Expect</code> module to use <code>expect</code>. CPAN.pm does not install it for you.</p>

<p><code>expect: &lt;array&gt;</code> is a short notation for this <code>eexpect</code>:</p>

<pre><code class="plaintext">eexpect:
	mode: deterministic
	timeout: 15
	talk: &lt;array&gt;</code></pre>

</dd>
</dl>

<h2 id="Schema-verification-with-Kwalify"><a class="permalink" href="CPAN.html#Schema-verification-with-Kwalify">#</a><a id="Schema"></a>Schema verification with <code>Kwalify</code></h2>

<p>If you have the <code>Kwalify</code> module installed (which is part of the Bundle::CPANxxl), then all your distroprefs files are checked for syntactic correctness.</p>

<h2 id="Example-Distroprefs-Files"><a class="permalink" href="CPAN.html#Example-Distroprefs-Files">#</a><a id="Example"></a>Example Distroprefs Files</h2>

<p><code>CPAN.pm</code> comes with a collection of example YAML files. Note that these are really just examples and should not be used without care because they cannot fit everybody&#39;s purpose. After all, the authors of the packages that ask questions had a need to ask, so you should watch their questions and adjust the examples to your environment and your needs. You have been warned:-)</p>

<h1 id="PROGRAMMER&#39;S-INTERFACE"><a class="permalink" href="CPAN.html#PROGRAMMER&#39;S-INTERFACE">#</a><a id="PROGRAMMER"></a><a id="PROGRAMMERS-INTERFACE"></a>PROGRAMMER&#39;S INTERFACE</h1>

<p>If you do not enter the shell, shell commands are available both as methods (<code>CPAN::Shell-&gt;install(...)</code>) and as functions in the calling package (<code>install(...)</code>). Before calling low-level commands, it makes sense to initialize components of CPAN you need, e.g.:</p>

<pre><code>CPAN::HandleConfig-&gt;load;
CPAN::Shell::setup_output;
CPAN::Index-&gt;reload;</code></pre>

<p>High-level commands do such initializations automatically.</p>

<p>There&#39;s currently only one class that has a stable interface - CPAN::Shell. All commands that are available in the CPAN shell are methods of the class CPAN::Shell. The arguments on the commandline are passed as arguments to the method.</p>

<p>So if you take for example the shell command</p>

<pre><code class="plaintext">notest install A B C</code></pre>

<p>the actually executed command is</p>

<pre><code>CPAN::Shell-&gt;notest(&quot;install&quot;,&quot;A&quot;,&quot;B&quot;,&quot;C&quot;);</code></pre>

<p>Each of the commands that produce listings of modules (<code>r</code>, <code>autobundle</code>, <code>u</code>) also return a list of the IDs of all modules within the list.</p>

<dl>

<dt id="expand($type,@things)"><a class="permalink" href="CPAN.html#expand($type,@things)">#</a><a id="expand"></a><a id="expand-type-things"></a>expand($type,@things)</dt>
<dd>

<p>The IDs of all objects available within a program are strings that can be expanded to the corresponding real objects with the <code>CPAN::Shell-&gt;expand(&quot;Module&quot;,@things)</code> method. Expand returns a list of CPAN::Module objects according to the <code>@things</code> arguments given. In scalar context, it returns only the first element of the list.</p>

</dd>
<dt id="expandany(@things)"><a class="permalink" href="CPAN.html#expandany(@things)">#</a><a id="expandany"></a><a id="expandany-things"></a>expandany(@things)</dt>
<dd>

<p>Like expand, but returns objects of the appropriate type, i.e. CPAN::Bundle objects for bundles, CPAN::Module objects for modules, and CPAN::Distribution objects for distributions. Note: it does not expand to CPAN::Author objects.</p>

</dd>
<dt id="Programming-Examples"><a class="permalink" href="CPAN.html#Programming-Examples">#</a><a id="Programming"></a>Programming Examples</dt>
<dd>

<p>This enables the programmer to do operations that combine functionalities that are available in the shell.</p>

<pre><code># install everything that is outdated on my disk:
perl -MCPAN -e &#39;CPAN::Shell-&gt;install(CPAN::Shell-&gt;r)&#39;

# install my favorite programs if necessary:
for $mod (qw(Net::FTP Digest::SHA Data::Dumper)) {
    CPAN::Shell-&gt;install($mod);
}

# list all modules on my disk that have no VERSION number
for $mod (CPAN::Shell-&gt;expand(&quot;Module&quot;,&quot;/./&quot;)) {
    next unless $mod-&gt;inst_file;
    # MakeMaker convention for undefined $VERSION:
    next unless $mod-&gt;inst_version eq &quot;undef&quot;;
    print &quot;No VERSION in &quot;, $mod-&gt;id, &quot;\n&quot;;
}

# find out which distribution on CPAN contains a module:
print CPAN::Shell-&gt;expand(&quot;Module&quot;,&quot;Apache::Constants&quot;)-&gt;cpan_file</code></pre>

<p>Or if you want to schedule a <i>cron</i> job to watch CPAN, you could list all modules that need updating. First a quick and dirty way:</p>

<pre><code>perl -e &#39;use CPAN; CPAN::Shell-&gt;r;&#39;</code></pre>

<p>If you don&#39;t want any output should all modules be up to date, parse the output of above command for the regular expression <code>/modules are up to date/</code> and decide to mail the output only if it doesn&#39;t match.</p>

<p>If you prefer to do it more in a programmerish style in one single process, something like this may better suit you:</p>

<pre><code># list all modules on my disk that have newer versions on CPAN
for $mod (CPAN::Shell-&gt;expand(&quot;Module&quot;,&quot;/./&quot;)) {
  next unless $mod-&gt;inst_file;
  next if $mod-&gt;uptodate;
  printf &quot;Module %s is installed as %s, could be updated to %s from CPAN\n&quot;,
      $mod-&gt;id, $mod-&gt;inst_version, $mod-&gt;cpan_version;
}</code></pre>

<p>If that gives too much output every day, you may want to watch only for three modules. You can write</p>

<pre><code>for $mod (CPAN::Shell-&gt;expand(&quot;Module&quot;,&quot;/Apache|LWP|CGI/&quot;)) {</code></pre>

<p>as the first line instead. Or you can combine some of the above tricks:</p>

<pre><code># watch only for a new mod_perl module
$mod = CPAN::Shell-&gt;expand(&quot;Module&quot;,&quot;mod_perl&quot;);
exit if $mod-&gt;uptodate;
# new mod_perl arrived, let me know all update recommendations
CPAN::Shell-&gt;r;</code></pre>

</dd>
</dl>

<h2 id="Methods-in-the-other-Classes"><a class="permalink" href="CPAN.html#Methods-in-the-other-Classes">#</a><a id="Methods"></a>Methods in the other Classes</h2>

<dl>

<dt id="CPAN::Author::as_glimpse()"><a class="permalink" href="CPAN.html#CPAN::Author::as_glimpse()">#</a><a id="CPAN3"></a><a id="CPAN::Author::as_glimpse"></a>CPAN::Author::as_glimpse()</dt>
<dd>

<p>Returns a one-line description of the author</p>

</dd>
<dt id="CPAN::Author::as_string()"><a class="permalink" href="CPAN.html#CPAN::Author::as_string()">#</a><a id="CPAN4"></a><a id="CPAN::Author::as_string"></a>CPAN::Author::as_string()</dt>
<dd>

<p>Returns a multi-line description of the author</p>

</dd>
<dt id="CPAN::Author::email()"><a class="permalink" href="CPAN.html#CPAN::Author::email()">#</a><a id="CPAN5"></a><a id="CPAN::Author::email"></a>CPAN::Author::email()</dt>
<dd>

<p>Returns the author&#39;s email address</p>

</dd>
<dt id="CPAN::Author::fullname()"><a class="permalink" href="CPAN.html#CPAN::Author::fullname()">#</a><a id="CPAN6"></a><a id="CPAN::Author::fullname"></a>CPAN::Author::fullname()</dt>
<dd>

<p>Returns the author&#39;s name</p>

</dd>
<dt id="CPAN::Author::name()"><a class="permalink" href="CPAN.html#CPAN::Author::name()">#</a><a id="CPAN7"></a><a id="CPAN::Author::name"></a>CPAN::Author::name()</dt>
<dd>

<p>An alias for fullname</p>

</dd>
<dt id="CPAN::Bundle::as_glimpse()"><a class="permalink" href="CPAN.html#CPAN::Bundle::as_glimpse()">#</a><a id="CPAN8"></a><a id="CPAN::Bundle::as_glimpse"></a>CPAN::Bundle::as_glimpse()</dt>
<dd>

<p>Returns a one-line description of the bundle</p>

</dd>
<dt id="CPAN::Bundle::as_string()"><a class="permalink" href="CPAN.html#CPAN::Bundle::as_string()">#</a><a id="CPAN9"></a><a id="CPAN::Bundle::as_string"></a>CPAN::Bundle::as_string()</dt>
<dd>

<p>Returns a multi-line description of the bundle</p>

</dd>
<dt id="CPAN::Bundle::clean()"><a class="permalink" href="CPAN.html#CPAN::Bundle::clean()">#</a><a id="CPAN10"></a><a id="CPAN::Bundle::clean"></a>CPAN::Bundle::clean()</dt>
<dd>

<p>Recursively runs the <code>clean</code> method on all items contained in the bundle.</p>

</dd>
<dt id="CPAN::Bundle::contains()"><a class="permalink" href="CPAN.html#CPAN::Bundle::contains()">#</a><a id="CPAN11"></a><a id="CPAN::Bundle::contains"></a>CPAN::Bundle::contains()</dt>
<dd>

<p>Returns a list of objects&#39; IDs contained in a bundle. The associated objects may be bundles, modules or distributions.</p>

</dd>
<dt id="CPAN::Bundle::force($method,@args)"><a class="permalink" href="CPAN.html#CPAN::Bundle::force($method,@args)">#</a><a id="CPAN12"></a><a id="CPAN::Bundle::force-method-args"></a>CPAN::Bundle::force($method,@args)</dt>
<dd>

<p>Forces CPAN to perform a task that it normally would have refused to do. Force takes as arguments a method name to be called and any number of additional arguments that should be passed to the called method. The internals of the object get the needed changes so that CPAN.pm does not refuse to take the action. The <code>force</code> is passed recursively to all contained objects. See also the section above on the <code>force</code> and the <code>fforce</code> pragma.</p>

</dd>
<dt id="CPAN::Bundle::get()"><a class="permalink" href="CPAN.html#CPAN::Bundle::get()">#</a><a id="CPAN13"></a><a id="CPAN::Bundle::get"></a>CPAN::Bundle::get()</dt>
<dd>

<p>Recursively runs the <code>get</code> method on all items contained in the bundle</p>

</dd>
<dt id="CPAN::Bundle::inst_file()"><a class="permalink" href="CPAN.html#CPAN::Bundle::inst_file()">#</a><a id="CPAN14"></a><a id="CPAN::Bundle::inst_file"></a>CPAN::Bundle::inst_file()</dt>
<dd>

<p>Returns the highest installed version of the bundle in either @INC or <code>$CPAN::Config-&gt;{cpan_home}</code>. Note that this is different from CPAN::Module::inst_file.</p>

</dd>
<dt id="CPAN::Bundle::inst_version()"><a class="permalink" href="CPAN.html#CPAN::Bundle::inst_version()">#</a><a id="CPAN15"></a><a id="CPAN::Bundle::inst_version"></a>CPAN::Bundle::inst_version()</dt>
<dd>

<p>Like CPAN::Bundle::inst_file, but returns the $VERSION</p>

</dd>
<dt id="CPAN::Bundle::uptodate()"><a class="permalink" href="CPAN.html#CPAN::Bundle::uptodate()">#</a><a id="CPAN16"></a><a id="CPAN::Bundle::uptodate"></a>CPAN::Bundle::uptodate()</dt>
<dd>

<p>Returns 1 if the bundle itself and all its members are up-to-date.</p>

</dd>
<dt id="CPAN::Bundle::install()"><a class="permalink" href="CPAN.html#CPAN::Bundle::install()">#</a><a id="CPAN17"></a><a id="CPAN::Bundle::install"></a>CPAN::Bundle::install()</dt>
<dd>

<p>Recursively runs the <code>install</code> method on all items contained in the bundle</p>

</dd>
<dt id="CPAN::Bundle::make()"><a class="permalink" href="CPAN.html#CPAN::Bundle::make()">#</a><a id="CPAN18"></a><a id="CPAN::Bundle::make"></a>CPAN::Bundle::make()</dt>
<dd>

<p>Recursively runs the <code>make</code> method on all items contained in the bundle</p>

</dd>
<dt id="CPAN::Bundle::readme()"><a class="permalink" href="CPAN.html#CPAN::Bundle::readme()">#</a><a id="CPAN19"></a><a id="CPAN::Bundle::readme"></a>CPAN::Bundle::readme()</dt>
<dd>

<p>Recursively runs the <code>readme</code> method on all items contained in the bundle</p>

</dd>
<dt id="CPAN::Bundle::test()"><a class="permalink" href="CPAN.html#CPAN::Bundle::test()">#</a><a id="CPAN20"></a><a id="CPAN::Bundle::test"></a>CPAN::Bundle::test()</dt>
<dd>

<p>Recursively runs the <code>test</code> method on all items contained in the bundle</p>

</dd>
<dt id="CPAN::Distribution::as_glimpse()"><a class="permalink" href="CPAN.html#CPAN::Distribution::as_glimpse()">#</a><a id="CPAN21"></a><a id="CPAN::Distribution::as_glimpse"></a>CPAN::Distribution::as_glimpse()</dt>
<dd>

<p>Returns a one-line description of the distribution</p>

</dd>
<dt id="CPAN::Distribution::as_string()"><a class="permalink" href="CPAN.html#CPAN::Distribution::as_string()">#</a><a id="CPAN22"></a><a id="CPAN::Distribution::as_string"></a>CPAN::Distribution::as_string()</dt>
<dd>

<p>Returns a multi-line description of the distribution</p>

</dd>
<dt id="CPAN::Distribution::author"><a class="permalink" href="CPAN.html#CPAN::Distribution::author">#</a><a id="CPAN23"></a>CPAN::Distribution::author</dt>
<dd>

<p>Returns the CPAN::Author object of the maintainer who uploaded this distribution</p>

</dd>
<dt id="CPAN::Distribution::pretty_id()"><a class="permalink" href="CPAN.html#CPAN::Distribution::pretty_id()">#</a><a id="CPAN24"></a><a id="CPAN::Distribution::pretty_id"></a>CPAN::Distribution::pretty_id()</dt>
<dd>

<p>Returns a string of the form &quot;AUTHORID/TARBALL&quot;, where AUTHORID is the author&#39;s PAUSE ID and TARBALL is the distribution filename.</p>

</dd>
<dt id="CPAN::Distribution::base_id()"><a class="permalink" href="CPAN.html#CPAN::Distribution::base_id()">#</a><a id="CPAN25"></a><a id="CPAN::Distribution::base_id"></a>CPAN::Distribution::base_id()</dt>
<dd>

<p>Returns the distribution filename without any archive suffix. E.g &quot;Foo-Bar-0.01&quot;</p>

</dd>
<dt id="CPAN::Distribution::clean()"><a class="permalink" href="CPAN.html#CPAN::Distribution::clean()">#</a><a id="CPAN26"></a><a id="CPAN::Distribution::clean"></a>CPAN::Distribution::clean()</dt>
<dd>

<p>Changes to the directory where the distribution has been unpacked and runs <code>make clean</code> there.</p>

</dd>
<dt id="CPAN::Distribution::containsmods()"><a class="permalink" href="CPAN.html#CPAN::Distribution::containsmods()">#</a><a id="CPAN27"></a><a id="CPAN::Distribution::containsmods"></a>CPAN::Distribution::containsmods()</dt>
<dd>

<p>Returns a list of IDs of modules contained in a distribution file. Works only for distributions listed in the 02packages.details.txt.gz file. This typically means that just most recent version of a distribution is covered.</p>

</dd>
<dt id="CPAN::Distribution::cvs_import()"><a class="permalink" href="CPAN.html#CPAN::Distribution::cvs_import()">#</a><a id="CPAN28"></a><a id="CPAN::Distribution::cvs_import"></a>CPAN::Distribution::cvs_import()</dt>
<dd>

<p>Changes to the directory where the distribution has been unpacked and runs something like</p>

<pre><code>cvs -d $cvs_root import -m $cvs_log $cvs_dir $userid v$version</code></pre>

<p>there.</p>

</dd>
<dt id="CPAN::Distribution::dir()"><a class="permalink" href="CPAN.html#CPAN::Distribution::dir()">#</a><a id="CPAN29"></a><a id="CPAN::Distribution::dir"></a>CPAN::Distribution::dir()</dt>
<dd>

<p>Returns the directory into which this distribution has been unpacked.</p>

</dd>
<dt id="CPAN::Distribution::force($method,@args)"><a class="permalink" href="CPAN.html#CPAN::Distribution::force($method,@args)">#</a><a id="CPAN30"></a><a id="CPAN::Distribution::force-method-args"></a>CPAN::Distribution::force($method,@args)</dt>
<dd>

<p>Forces CPAN to perform a task that it normally would have refused to do. Force takes as arguments a method name to be called and any number of additional arguments that should be passed to the called method. The internals of the object get the needed changes so that CPAN.pm does not refuse to take the action. See also the section above on the <code>force</code> and the <code>fforce</code> pragma.</p>

</dd>
<dt id="CPAN::Distribution::get()"><a class="permalink" href="CPAN.html#CPAN::Distribution::get()">#</a><a id="CPAN31"></a><a id="CPAN::Distribution::get"></a>CPAN::Distribution::get()</dt>
<dd>

<p>Downloads the distribution from CPAN and unpacks it. Does nothing if the distribution has already been downloaded and unpacked within the current session.</p>

</dd>
<dt id="CPAN::Distribution::install()"><a class="permalink" href="CPAN.html#CPAN::Distribution::install()">#</a><a id="CPAN32"></a><a id="CPAN::Distribution::install"></a>CPAN::Distribution::install()</dt>
<dd>

<p>Changes to the directory where the distribution has been unpacked and runs the external command <code>make install</code> there. If <code>make</code> has not yet been run, it will be run first. A <code>make test</code> is issued in any case and if this fails, the install is cancelled. The cancellation can be avoided by letting <code>force</code> run the <code>install</code> for you.</p>

<p>This install method only has the power to install the distribution if there are no dependencies in the way. To install an object along with all its dependencies, use CPAN::Shell-&gt;install.</p>

<p>Note that install() gives no meaningful return value. See uptodate().</p>

</dd>
<dt id="CPAN::Distribution::isa_perl()"><a class="permalink" href="CPAN.html#CPAN::Distribution::isa_perl()">#</a><a id="CPAN33"></a><a id="CPAN::Distribution::isa_perl"></a>CPAN::Distribution::isa_perl()</dt>
<dd>

<p>Returns 1 if this distribution file seems to be a perl distribution. Normally this is derived from the file name only, but the index from CPAN can contain a hint to achieve a return value of true for other filenames too.</p>

</dd>
<dt id="CPAN::Distribution::look()"><a class="permalink" href="CPAN.html#CPAN::Distribution::look()">#</a><a id="CPAN34"></a><a id="CPAN::Distribution::look"></a>CPAN::Distribution::look()</dt>
<dd>

<p>Changes to the directory where the distribution has been unpacked and opens a subshell there. Exiting the subshell returns.</p>

</dd>
<dt id="CPAN::Distribution::make()"><a class="permalink" href="CPAN.html#CPAN::Distribution::make()">#</a><a id="CPAN35"></a><a id="CPAN::Distribution::make"></a>CPAN::Distribution::make()</dt>
<dd>

<p>First runs the <code>get</code> method to make sure the distribution is downloaded and unpacked. Changes to the directory where the distribution has been unpacked and runs the external commands <code>perl Makefile.PL</code> or <code>perl Build.PL</code> and <code>make</code> there.</p>

</dd>
<dt id="CPAN::Distribution::perldoc()"><a class="permalink" href="CPAN.html#CPAN::Distribution::perldoc()">#</a><a id="CPAN36"></a><a id="CPAN::Distribution::perldoc"></a>CPAN::Distribution::perldoc()</dt>
<dd>

<p>Downloads the pod documentation of the file associated with a distribution (in HTML format) and runs it through the external command <i>lynx</i> specified in <code>$CPAN::Config-&gt;{lynx}</code>. If <i>lynx</i> isn&#39;t available, it converts it to plain text with the external command <i>html2text</i> and runs it through the pager specified in <code>$CPAN::Config-&gt;{pager}</code>.</p>

</dd>
<dt id="CPAN::Distribution::prefs()"><a class="permalink" href="CPAN.html#CPAN::Distribution::prefs()">#</a><a id="CPAN37"></a><a id="CPAN::Distribution::prefs"></a>CPAN::Distribution::prefs()</dt>
<dd>

<p>Returns the hash reference from the first matching YAML file that the user has deposited in the <code>prefs_dir/</code> directory. The first succeeding match wins. The files in the <code>prefs_dir/</code> are processed alphabetically, and the canonical distro name (e.g. AUTHOR/Foo-Bar-3.14.tar.gz) is matched against the regular expressions stored in the $root-&gt;{match}{distribution} attribute value. Additionally all module names contained in a distribution are matched against the regular expressions in the $root-&gt;{match}{module} attribute value. The two match values are ANDed together. Each of the two attributes are optional.</p>

</dd>
<dt id="CPAN::Distribution::prereq_pm()"><a class="permalink" href="CPAN.html#CPAN::Distribution::prereq_pm()">#</a><a id="CPAN38"></a><a id="CPAN::Distribution::prereq_pm"></a>CPAN::Distribution::prereq_pm()</dt>
<dd>

<p>Returns the hash reference that has been announced by a distribution as the <code>requires</code> and <code>build_requires</code> elements. These can be declared either by the <code>META.yml</code> (if authoritative) or can be deposited after the run of <code>Build.PL</code> in the file <code>./_build/prereqs</code> or after the run of <code>Makfile.PL</code> written as the <code>PREREQ_PM</code> hash in a comment in the produced <code>Makefile</code>. <i>Note</i>: this method only works after an attempt has been made to <code>make</code> the distribution. Returns undef otherwise.</p>

</dd>
<dt id="CPAN::Distribution::readme()"><a class="permalink" href="CPAN.html#CPAN::Distribution::readme()">#</a><a id="CPAN39"></a><a id="CPAN::Distribution::readme"></a>CPAN::Distribution::readme()</dt>
<dd>

<p>Downloads the README file associated with a distribution and runs it through the pager specified in <code>$CPAN::Config-&gt;{pager}</code>.</p>

</dd>
<dt id="CPAN::Distribution::reports()"><a class="permalink" href="CPAN.html#CPAN::Distribution::reports()">#</a><a id="CPAN40"></a><a id="CPAN::Distribution::reports"></a>CPAN::Distribution::reports()</dt>
<dd>

<p>Downloads report data for this distribution from www.cpantesters.org and displays a subset of them.</p>

</dd>
<dt id="CPAN::Distribution::read_yaml()"><a class="permalink" href="CPAN.html#CPAN::Distribution::read_yaml()">#</a><a id="CPAN41"></a><a id="CPAN::Distribution::read_yaml"></a>CPAN::Distribution::read_yaml()</dt>
<dd>

<p>Returns the content of the META.yml of this distro as a hashref. Note: works only after an attempt has been made to <code>make</code> the distribution. Returns undef otherwise. Also returns undef if the content of META.yml is not authoritative. (The rules about what exactly makes the content authoritative are still in flux.)</p>

</dd>
<dt id="CPAN::Distribution::test()"><a class="permalink" href="CPAN.html#CPAN::Distribution::test()">#</a><a id="CPAN42"></a><a id="CPAN::Distribution::test"></a>CPAN::Distribution::test()</dt>
<dd>

<p>Changes to the directory where the distribution has been unpacked and runs <code>make test</code> there.</p>

</dd>
<dt id="CPAN::Distribution::uptodate()"><a class="permalink" href="CPAN.html#CPAN::Distribution::uptodate()">#</a><a id="CPAN43"></a><a id="CPAN::Distribution::uptodate"></a>CPAN::Distribution::uptodate()</dt>
<dd>

<p>Returns 1 if all the modules contained in the distribution are up-to-date. Relies on containsmods.</p>

</dd>
<dt id="CPAN::Index::force_reload()"><a class="permalink" href="CPAN.html#CPAN::Index::force_reload()">#</a><a id="CPAN44"></a><a id="CPAN::Index::force_reload"></a>CPAN::Index::force_reload()</dt>
<dd>

<p>Forces a reload of all indices.</p>

</dd>
<dt id="CPAN::Index::reload()"><a class="permalink" href="CPAN.html#CPAN::Index::reload()">#</a><a id="CPAN45"></a><a id="CPAN::Index::reload"></a>CPAN::Index::reload()</dt>
<dd>

<p>Reloads all indices if they have not been read for more than <code>$CPAN::Config-&gt;{index_expire}</code> days.</p>

</dd>
<dt id="CPAN::InfoObj::dump()"><a class="permalink" href="CPAN.html#CPAN::InfoObj::dump()">#</a><a id="CPAN46"></a><a id="CPAN::InfoObj::dump"></a>CPAN::InfoObj::dump()</dt>
<dd>

<p>CPAN::Author, CPAN::Bundle, CPAN::Module, and CPAN::Distribution inherit this method. It prints the data structure associated with an object. Useful for debugging. Note: the data structure is considered internal and thus subject to change without notice.</p>

</dd>
<dt id="CPAN::Module::as_glimpse()"><a class="permalink" href="CPAN.html#CPAN::Module::as_glimpse()">#</a><a id="CPAN47"></a><a id="CPAN::Module::as_glimpse"></a>CPAN::Module::as_glimpse()</dt>
<dd>

<p>Returns a one-line description of the module in four columns: The first column contains the word <code>Module</code>, the second column consists of one character: an equals sign if this module is already installed and up-to-date, a less-than sign if this module is installed but can be upgraded, and a space if the module is not installed. The third column is the name of the module and the fourth column gives maintainer or distribution information.</p>

</dd>
<dt id="CPAN::Module::as_string()"><a class="permalink" href="CPAN.html#CPAN::Module::as_string()">#</a><a id="CPAN48"></a><a id="CPAN::Module::as_string"></a>CPAN::Module::as_string()</dt>
<dd>

<p>Returns a multi-line description of the module</p>

</dd>
<dt id="CPAN::Module::clean()"><a class="permalink" href="CPAN.html#CPAN::Module::clean()">#</a><a id="CPAN49"></a><a id="CPAN::Module::clean"></a>CPAN::Module::clean()</dt>
<dd>

<p>Runs a clean on the distribution associated with this module.</p>

</dd>
<dt id="CPAN::Module::cpan_file()"><a class="permalink" href="CPAN.html#CPAN::Module::cpan_file()">#</a><a id="CPAN50"></a><a id="CPAN::Module::cpan_file"></a>CPAN::Module::cpan_file()</dt>
<dd>

<p>Returns the filename on CPAN that is associated with the module.</p>

</dd>
<dt id="CPAN::Module::cpan_version()"><a class="permalink" href="CPAN.html#CPAN::Module::cpan_version()">#</a><a id="CPAN51"></a><a id="CPAN::Module::cpan_version"></a>CPAN::Module::cpan_version()</dt>
<dd>

<p>Returns the latest version of this module available on CPAN.</p>

</dd>
<dt id="CPAN::Module::cvs_import()"><a class="permalink" href="CPAN.html#CPAN::Module::cvs_import()">#</a><a id="CPAN52"></a><a id="CPAN::Module::cvs_import"></a>CPAN::Module::cvs_import()</dt>
<dd>

<p>Runs a cvs_import on the distribution associated with this module.</p>

</dd>
<dt id="CPAN::Module::description()"><a class="permalink" href="CPAN.html#CPAN::Module::description()">#</a><a id="CPAN53"></a><a id="CPAN::Module::description"></a>CPAN::Module::description()</dt>
<dd>

<p>Returns a 44 character description of this module. Only available for modules listed in The Module List (CPAN/modules/00modlist.long.html or 00modlist.long.txt.gz)</p>

</dd>
<dt id="CPAN::Module::distribution()"><a class="permalink" href="CPAN.html#CPAN::Module::distribution()">#</a><a id="CPAN54"></a><a id="CPAN::Module::distribution"></a>CPAN::Module::distribution()</dt>
<dd>

<p>Returns the CPAN::Distribution object that contains the current version of this module.</p>

</dd>
<dt id="CPAN::Module::dslip_status()"><a class="permalink" href="CPAN.html#CPAN::Module::dslip_status()">#</a><a id="CPAN55"></a><a id="CPAN::Module::dslip_status"></a>CPAN::Module::dslip_status()</dt>
<dd>

<p>Returns a hash reference. The keys of the hash are the letters <code>D</code>, <code>S</code>, <code>L</code>, <code>I</code>, and &lt;P&gt;, for development status, support level, language, interface and public licence respectively. The data for the DSLIP status are collected by pause.perl.org when authors register their namespaces. The values of the 5 hash elements are one-character words whose meaning is described in the table below. There are also 5 hash elements <code>DV</code>, <code>SV</code>, <code>LV</code>, <code>IV</code>, and &lt;PV&gt; that carry a more verbose value of the 5 status variables.</p>

<p>Where the &#39;DSLIP&#39; characters have the following meanings:</p>

<pre><code class="plaintext">D - Development Stage  (Note: *NO IMPLIED TIMESCALES*):
  i   - Idea, listed to gain consensus or as a placeholder
  c   - under construction but pre-alpha (not yet released)
  a/b - Alpha/Beta testing
  R   - Released
  M   - Mature (no rigorous definition)
  S   - Standard, supplied with Perl 5

S - Support Level:
  m   - Mailing-list
  d   - Developer
  u   - Usenet newsgroup comp.lang.perl.modules
  n   - None known, try comp.lang.perl.modules
  a   - abandoned; volunteers welcome to take over maintenance

L - Language Used:
  p   - Perl-only, no compiler needed, should be platform independent
  c   - C and perl, a C compiler will be needed
  h   - Hybrid, written in perl with optional C code, no compiler needed
  +   - C++ and perl, a C++ compiler will be needed
  o   - perl and another language other than C or C++

I - Interface Style
  f   - plain Functions, no references used
  h   - hybrid, object and function interfaces available
  n   - no interface at all (huh?)
  r   - some use of unblessed References or ties
  O   - Object oriented using blessed references and/or inheritance

P - Public License
  p   - Standard-Perl: user may choose between GPL and Artistic
  g   - GPL: GNU General Public License
  l   - LGPL: &quot;GNU Lesser General Public License&quot; (previously known as
        &quot;GNU Library General Public License&quot;)
  b   - BSD: The BSD License
  a   - Artistic license alone
  2   - Artistic license 2.0 or later
  o   - open source: approved by www.opensource.org
  d   - allows distribution without restrictions
  r   - restricted distribution
  n   - no license at all</code></pre>

</dd>
<dt id="CPAN::Module::force($method,@args)"><a class="permalink" href="CPAN.html#CPAN::Module::force($method,@args)">#</a><a id="CPAN56"></a><a id="CPAN::Module::force-method-args"></a>CPAN::Module::force($method,@args)</dt>
<dd>

<p>Forces CPAN to perform a task it would normally refuse to do. Force takes as arguments a method name to be invoked and any number of additional arguments to pass that method. The internals of the object get the needed changes so that CPAN.pm does not refuse to take the action. See also the section above on the <code>force</code> and the <code>fforce</code> pragma.</p>

</dd>
<dt id="CPAN::Module::get()"><a class="permalink" href="CPAN.html#CPAN::Module::get()">#</a><a id="CPAN57"></a><a id="CPAN::Module::get"></a>CPAN::Module::get()</dt>
<dd>

<p>Runs a get on the distribution associated with this module.</p>

</dd>
<dt id="CPAN::Module::inst_file()"><a class="permalink" href="CPAN.html#CPAN::Module::inst_file()">#</a><a id="CPAN58"></a><a id="CPAN::Module::inst_file"></a>CPAN::Module::inst_file()</dt>
<dd>

<p>Returns the filename of the module found in @INC. The first file found is reported, just as perl itself stops searching @INC once it finds a module.</p>

</dd>
<dt id="CPAN::Module::available_file()"><a class="permalink" href="CPAN.html#CPAN::Module::available_file()">#</a><a id="CPAN59"></a><a id="CPAN::Module::available_file"></a>CPAN::Module::available_file()</dt>
<dd>

<p>Returns the filename of the module found in PERL5LIB or @INC. The first file found is reported. The advantage of this method over <code>inst_file</code> is that modules that have been tested but not yet installed are included because PERL5LIB keeps track of tested modules.</p>

</dd>
<dt id="CPAN::Module::inst_version()"><a class="permalink" href="CPAN.html#CPAN::Module::inst_version()">#</a><a id="CPAN60"></a><a id="CPAN::Module::inst_version"></a>CPAN::Module::inst_version()</dt>
<dd>

<p>Returns the version number of the installed module in readable format.</p>

</dd>
<dt id="CPAN::Module::available_version()"><a class="permalink" href="CPAN.html#CPAN::Module::available_version()">#</a><a id="CPAN61"></a><a id="CPAN::Module::available_version"></a>CPAN::Module::available_version()</dt>
<dd>

<p>Returns the version number of the available module in readable format.</p>

</dd>
<dt id="CPAN::Module::install()"><a class="permalink" href="CPAN.html#CPAN::Module::install()">#</a><a id="CPAN62"></a><a id="CPAN::Module::install"></a>CPAN::Module::install()</dt>
<dd>

<p>Runs an <code>install</code> on the distribution associated with this module.</p>

</dd>
<dt id="CPAN::Module::look()"><a class="permalink" href="CPAN.html#CPAN::Module::look()">#</a><a id="CPAN63"></a><a id="CPAN::Module::look"></a>CPAN::Module::look()</dt>
<dd>

<p>Changes to the directory where the distribution associated with this module has been unpacked and opens a subshell there. Exiting the subshell returns.</p>

</dd>
<dt id="CPAN::Module::make()"><a class="permalink" href="CPAN.html#CPAN::Module::make()">#</a><a id="CPAN64"></a><a id="CPAN::Module::make"></a>CPAN::Module::make()</dt>
<dd>

<p>Runs a <code>make</code> on the distribution associated with this module.</p>

</dd>
<dt id="CPAN::Module::manpage_headline()"><a class="permalink" href="CPAN.html#CPAN::Module::manpage_headline()">#</a><a id="CPAN65"></a><a id="CPAN::Module::manpage_headline"></a>CPAN::Module::manpage_headline()</dt>
<dd>

<p>If module is installed, peeks into the module&#39;s manpage, reads the headline, and returns it. Moreover, if the module has been downloaded within this session, does the equivalent on the downloaded module even if it hasn&#39;t been installed yet.</p>

</dd>
<dt id="CPAN::Module::perldoc()"><a class="permalink" href="CPAN.html#CPAN::Module::perldoc()">#</a><a id="CPAN66"></a><a id="CPAN::Module::perldoc"></a>CPAN::Module::perldoc()</dt>
<dd>

<p>Runs a <code>perldoc</code> on this module.</p>

</dd>
<dt id="CPAN::Module::readme()"><a class="permalink" href="CPAN.html#CPAN::Module::readme()">#</a><a id="CPAN67"></a><a id="CPAN::Module::readme"></a>CPAN::Module::readme()</dt>
<dd>

<p>Runs a <code>readme</code> on the distribution associated with this module.</p>

</dd>
<dt id="CPAN::Module::reports()"><a class="permalink" href="CPAN.html#CPAN::Module::reports()">#</a><a id="CPAN68"></a><a id="CPAN::Module::reports"></a>CPAN::Module::reports()</dt>
<dd>

<p>Calls the reports() method on the associated distribution object.</p>

</dd>
<dt id="CPAN::Module::test()"><a class="permalink" href="CPAN.html#CPAN::Module::test()">#</a><a id="CPAN69"></a><a id="CPAN::Module::test"></a>CPAN::Module::test()</dt>
<dd>

<p>Runs a <code>test</code> on the distribution associated with this module.</p>

</dd>
<dt id="CPAN::Module::uptodate()"><a class="permalink" href="CPAN.html#CPAN::Module::uptodate()">#</a><a id="CPAN70"></a><a id="CPAN::Module::uptodate"></a>CPAN::Module::uptodate()</dt>
<dd>

<p>Returns 1 if the module is installed and up-to-date.</p>

</dd>
<dt id="CPAN::Module::userid()"><a class="permalink" href="CPAN.html#CPAN::Module::userid()">#</a><a id="CPAN71"></a><a id="CPAN::Module::userid"></a>CPAN::Module::userid()</dt>
<dd>

<p>Returns the author&#39;s ID of the module.</p>

</dd>
</dl>

<h2 id="Cache-Manager"><a class="permalink" href="CPAN.html#Cache-Manager">#</a><a id="Cache"></a>Cache Manager</h2>

<p>Currently the cache manager only keeps track of the build directory ($CPAN::Config-&gt;{build_dir}). It is a simple FIFO mechanism that deletes complete directories below <code>build_dir</code> as soon as the size of all directories there gets bigger than $CPAN::Config-&gt;{build_cache} (in MB). The contents of this cache may be used for later re-installations that you intend to do manually, but will never be trusted by CPAN itself. This is due to the fact that the user might use these directories for building modules on different architectures.</p>

<p>There is another directory ($CPAN::Config-&gt;{keep_source_where}) where the original distribution files are kept. This directory is not covered by the cache manager and must be controlled by the user. If you choose to have the same directory as build_dir and as keep_source_where directory, then your sources will be deleted with the same fifo mechanism.</p>

<h2 id="Bundles"><a class="permalink" href="CPAN.html#Bundles">#</a>Bundles</h2>

<p>A bundle is just a perl module in the namespace Bundle:: that does not define any functions or methods. It usually only contains documentation.</p>

<p>It starts like a perl module with a package declaration and a $VERSION variable. After that the pod section looks like any other pod with the only difference being that <i>one special pod section</i> exists starting with (verbatim):</p>

<pre><code class="plaintext">=head1 CONTENTS</code></pre>

<p>In this pod section each line obeys the format</p>

<pre><code class="plaintext">Module_Name [Version_String] [- optional text]</code></pre>

<p>The only required part is the first field, the name of a module (e.g. Foo::Bar, i.e. <i>not</i> the name of the distribution file). The rest of the line is optional. The comment part is delimited by a dash just as in the man page header.</p>

<p>The distribution of a bundle should follow the same convention as other distributions.</p>

<p>Bundles are treated specially in the CPAN package. If you say &#39;install Bundle::Tkkit&#39; (assuming such a bundle exists), CPAN will install all the modules in the CONTENTS section of the pod. You can install your own Bundles locally by placing a conformant Bundle file somewhere into your @INC path. The autobundle() command which is available in the shell interface does that for you by including all currently installed modules in a snapshot bundle file.</p>

<h1 id="PREREQUISITES"><a class="permalink" href="CPAN.html#PREREQUISITES">#</a>PREREQUISITES</h1>

<p>The CPAN program is trying to depend on as little as possible so the user can use it in hostile environment. It works better the more goodies the environment provides. For example if you try in the CPAN shell</p>

<pre><code class="plaintext">install Bundle::CPAN</code></pre>

<p>or</p>

<pre><code class="plaintext">install Bundle::CPANxxl</code></pre>

<p>you will find the shell more convenient than the bare shell before.</p>

<p>If you have a local mirror of CPAN and can access all files with &quot;file:&quot; URLs, then you only need a perl later than perl5.003 to run this module. Otherwise Net::FTP is strongly recommended. LWP may be required for non-UNIX systems, or if your nearest CPAN site is associated with a URL that is not <code>ftp:</code>.</p>

<p>If you have neither Net::FTP nor LWP, there is a fallback mechanism implemented for an external ftp command or for an external lynx command.</p>

<h1 id="UTILITIES"><a class="permalink" href="CPAN.html#UTILITIES">#</a>UTILITIES</h1>

<h2 id="Finding-packages-and-VERSION"><a class="permalink" href="CPAN.html#Finding-packages-and-VERSION">#</a><a id="Finding"></a>Finding packages and VERSION</h2>

<p>This module presumes that all packages on CPAN</p>

<ul>

<li><p>declare their $VERSION variable in an easy to parse manner. This prerequisite can hardly be relaxed because it consumes far too much memory to load all packages into the running program just to determine the $VERSION variable. Currently all programs that are dealing with version use something like this</p>

<pre><code>perl -MExtUtils::MakeMaker -le \
    &#39;print MM-&gt;parse_version(shift)&#39; filename</code></pre>

<p>If you are author of a package and wonder if your $VERSION can be parsed, please try the above method.</p>

</li>
<li><p>come as compressed or gzipped tarfiles or as zip files and contain a <code>Makefile.PL</code> or <code>Build.PL</code> (well, we try to handle a bit more, but with little enthusiasm).</p>

</li>
</ul>

<h2 id="Debugging"><a class="permalink" href="CPAN.html#Debugging">#</a>Debugging</h2>

<p>Debugging this module is more than a bit complex due to interference from the software producing the indices on CPAN, the mirroring process on CPAN, packaging, configuration, synchronicity, and even (gasp!) due to bugs within the CPAN.pm module itself.</p>

<p>For debugging the code of CPAN.pm itself in interactive mode, some debugging aid can be turned on for most packages within CPAN.pm with one of</p>

<dl>

<dt id="o-debug-package..."><a class="permalink" href="CPAN.html#o-debug-package...">#</a><a id="o5"></a><a id="o-debug-package"></a>o debug package...</dt>
<dd>

<p>sets debug mode for packages.</p>

</dd>
<dt id="o-debug-package...1"><a class="permalink" href="CPAN.html#o-debug-package...1">#</a><a id="o6"></a><a id="o-debug--package"></a>o debug -package...</dt>
<dd>

<p>unsets debug mode for packages.</p>

</dd>
<dt id="o-debug-all"><a class="permalink" href="CPAN.html#o-debug-all">#</a><a id="o7"></a>o debug all</dt>
<dd>

<p>turns debugging on for all packages.</p>

</dd>
<dt id="o-debug-number"><a class="permalink" href="CPAN.html#o-debug-number">#</a><a id="o8"></a>o debug number</dt>
<dd>

</dd>
</dl>

<p>which sets the debugging packages directly. Note that <code>o debug 0</code> turns debugging off.</p>

<p>What seems a successful strategy is the combination of <code>reload cpan</code> and the debugging switches. Add a new debug statement while running in the shell and then issue a <code>reload cpan</code> and see the new debugging messages immediately without losing the current context.</p>

<p><code>o debug</code> without an argument lists the valid package names and the current set of packages in debugging mode. <code>o debug</code> has built-in completion support.</p>

<p>For debugging of CPAN data there is the <code>dump</code> command which takes the same arguments as make/test/install and outputs each object&#39;s Data::Dumper dump. If an argument looks like a perl variable and contains one of <code>$</code>, <code>@</code> or <code>%</code>, it is eval()ed and fed to Data::Dumper directly.</p>

<h2 id="Floppy,-Zip,-Offline-Mode"><a class="permalink" href="CPAN.html#Floppy,-Zip,-Offline-Mode">#</a><a id="Floppy"></a><a id="Floppy-Zip-Offline-Mode"></a>Floppy, Zip, Offline Mode</h2>

<p>CPAN.pm works nicely without network access, too. If you maintain machines that are not networked at all, you should consider working with <code>file:</code> URLs. You&#39;ll have to collect your modules somewhere first. So you might use CPAN.pm to put together all you need on a networked machine. Then copy the $CPAN::Config-&gt;{keep_source_where} (but not $CPAN::Config-&gt;{build_dir}) directory on a floppy. This floppy is kind of a personal CPAN. CPAN.pm on the non-networked machines works nicely with this floppy. See also below the paragraph about CD-ROM support.</p>

<h2 id="Basic-Utilities-for-Programmers"><a class="permalink" href="CPAN.html#Basic-Utilities-for-Programmers">#</a><a id="Basic"></a>Basic Utilities for Programmers</h2>

<dl>

<dt id="has_inst($module)"><a class="permalink" href="CPAN.html#has_inst($module)">#</a><a id="has_inst"></a><a id="has_inst-module"></a>has_inst($module)</dt>
<dd>

<p>Returns true if the module is installed. Used to load all modules into the running CPAN.pm that are considered optional. The config variable <code>dontload_list</code> intercepts the <code>has_inst()</code> call such that an optional module is not loaded despite being available. For example, the following command will prevent <code>YAML.pm</code> from being loaded:</p>

<pre><code class="plaintext">cpan&gt; o conf dontload_list push YAML</code></pre>

<p>See the source for details.</p>

</dd>
<dt id="use_inst($module)"><a class="permalink" href="CPAN.html#use_inst($module)">#</a><a id="use_inst"></a><a id="use_inst-module"></a>use_inst($module)</dt>
<dd>

<p>Similary to <a href="https://perldoc.perl.org/5.35.0/has_inst()">has_inst()</a> tries to load optional library but also dies if library is not available</p>

</dd>
<dt id="has_usable($module)"><a class="permalink" href="CPAN.html#has_usable($module)">#</a><a id="has_usable"></a><a id="has_usable-module"></a>has_usable($module)</dt>
<dd>

<p>Returns true if the module is installed and in a usable state. Only useful for a handful of modules that are used internally. See the source for details.</p>

</dd>
<dt id="instance($module)"><a class="permalink" href="CPAN.html#instance($module)">#</a><a id="instance"></a><a id="instance-module"></a>instance($module)</dt>
<dd>

<p>The constructor for all the singletons used to represent modules, distributions, authors, and bundles. If the object already exists, this method returns the object; otherwise, it calls the constructor.</p>

</dd>
<dt id="frontend()"><a class="permalink" href="CPAN.html#frontend()">#</a><a id="frontend"></a>frontend()</dt>
<dd>

</dd>
<dt id="frontend($new_frontend)"><a class="permalink" href="CPAN.html#frontend($new_frontend)">#</a><a id="frontend1"></a><a id="frontend-new_frontend"></a>frontend($new_frontend)</dt>
<dd>

<p>Getter/setter for frontend object. Method just allows to subclass CPAN.pm.</p>

</dd>
</dl>

<h1 id="SECURITY"><a class="permalink" href="CPAN.html#SECURITY">#</a>SECURITY</h1>

<p>There&#39;s no strong security layer in CPAN.pm. CPAN.pm helps you to install foreign, unmasked, unsigned code on your machine. We compare to a checksum that comes from the net just as the distribution file itself. But we try to make it easy to add security on demand:</p>

<h2 id="Cryptographically-signed-modules"><a class="permalink" href="CPAN.html#Cryptographically-signed-modules">#</a><a id="Cryptographically"></a>Cryptographically signed modules</h2>

<p>Since release 1.77, CPAN.pm has been able to verify cryptographically signed module distributions using Module::Signature. The CPAN modules can be signed by their authors, thus giving more security. The simple unsigned MD5 checksums that were used before by CPAN protect mainly against accidental file corruption.</p>

<p>You will need to have Module::Signature installed, which in turn requires that you have at least one of Crypt::OpenPGP module or the command-line <i>gpg</i> tool installed.</p>

<p>You will also need to be able to connect over the Internet to the public key servers, like pgp.mit.edu, and their port 11731 (the HKP protocol).</p>

<p>The configuration parameter check_sigs is there to turn signature checking on or off.</p>

<h1 id="EXPORT"><a class="permalink" href="CPAN.html#EXPORT">#</a>EXPORT</h1>

<p>Most functions in package CPAN are exported by default. The reason for this is that the primary use is intended for the cpan shell or for one-liners.</p>

<h1 id="ENVIRONMENT"><a class="permalink" href="CPAN.html#ENVIRONMENT">#</a>ENVIRONMENT</h1>

<p>When the CPAN shell enters a subshell via the look command, it sets the environment CPAN_SHELL_LEVEL to 1, or increments that variable if it is already set.</p>

<p>When CPAN runs, it sets the environment variable PERL5_CPAN_IS_RUNNING to the ID of the running process. It also sets PERL5_CPANPLUS_IS_RUNNING to prevent runaway processes which could happen with older versions of Module::Install.</p>

<p>When running <code>perl Makefile.PL</code>, the environment variable <code>PERL5_CPAN_IS_EXECUTING</code> is set to the full path of the <code>Makefile.PL</code> that is being executed. This prevents runaway processes with newer versions of Module::Install.</p>

<p>When the config variable ftp_passive is set, all downloads will be run with the environment variable FTP_PASSIVE set to this value. This is in general a good idea as it influences both Net::FTP and LWP based connections. The same effect can be achieved by starting the cpan shell with this environment variable set. For Net::FTP alone, one can also always set passive mode by running libnetcfg.</p>

<h1 id="POPULATE-AN-INSTALLATION-WITH-LOTS-OF-MODULES"><a class="permalink" href="CPAN.html#POPULATE-AN-INSTALLATION-WITH-LOTS-OF-MODULES">#</a><a id="POPULATE"></a>POPULATE AN INSTALLATION WITH LOTS OF MODULES</h1>

<p>Populating a freshly installed perl with one&#39;s favorite modules is pretty easy if you maintain a private bundle definition file. To get a useful blueprint of a bundle definition file, the command autobundle can be used on the CPAN shell command line. This command writes a bundle definition file for all modules installed for the current perl interpreter. It&#39;s recommended to run this command once only, and from then on maintain the file manually under a private name, say Bundle/my_bundle.pm. With a clever bundle file you can then simply say</p>

<pre><code class="plaintext">cpan&gt; install Bundle::my_bundle</code></pre>

<p>then answer a few questions and go out for coffee (possibly even in a different city).</p>

<p>Maintaining a bundle definition file means keeping track of two things: dependencies and interactivity. CPAN.pm sometimes fails on calculating dependencies because not all modules define all MakeMaker attributes correctly, so a bundle definition file should specify prerequisites as early as possible. On the other hand, it&#39;s annoying that so many distributions need some interactive configuring. So what you can try to accomplish in your private bundle file is to have the packages that need to be configured early in the file and the gentle ones later, so you can go out for coffee after a few minutes and leave CPAN.pm to churn away unattended.</p>

<h1 id="WORKING-WITH-CPAN.pm-BEHIND-FIREWALLS"><a class="permalink" href="CPAN.html#WORKING-WITH-CPAN.pm-BEHIND-FIREWALLS">#</a><a id="WORKING"></a>WORKING WITH CPAN.pm BEHIND FIREWALLS</h1>

<p>Thanks to Graham Barr for contributing the following paragraphs about the interaction between perl, and various firewall configurations. For further information on firewalls, it is recommended to consult the documentation that comes with the <i>ncftp</i> program. If you are unable to go through the firewall with a simple Perl setup, it is likely that you can configure <i>ncftp</i> so that it works through your firewall.</p>

<h2 id="Three-basic-types-of-firewalls"><a class="permalink" href="CPAN.html#Three-basic-types-of-firewalls">#</a><a id="Three"></a>Three basic types of firewalls</h2>

<p>Firewalls can be categorized into three basic types.</p>

<dl>

<dt id="http-firewall"><a class="permalink" href="CPAN.html#http-firewall">#</a><a id="http"></a>http firewall</dt>
<dd>

<p>This is when the firewall machine runs a web server, and to access the outside world, you must do so via that web server. If you set environment variables like http_proxy or ftp_proxy to values beginning with http://, or in your web browser you&#39;ve proxy information set, then you know you are running behind an http firewall.</p>

<p>To access servers outside these types of firewalls with perl (even for ftp), you need LWP or HTTP::Tiny.</p>

</dd>
<dt id="ftp-firewall"><a class="permalink" href="CPAN.html#ftp-firewall">#</a><a id="ftp"></a>ftp firewall</dt>
<dd>

<p>This where the firewall machine runs an ftp server. This kind of firewall will only let you access ftp servers outside the firewall. This is usually done by connecting to the firewall with ftp, then entering a username like &quot;user@outside.host.com&quot;.</p>

<p>To access servers outside these type of firewalls with perl, you need Net::FTP.</p>

</dd>
<dt id="One-way-visibility"><a class="permalink" href="CPAN.html#One-way-visibility">#</a><a id="One"></a>One-way visibility</dt>
<dd>

<p>One-way visibility means these firewalls try to make themselves invisible to users inside the firewall. An FTP data connection is normally created by sending your IP address to the remote server and then listening for the return connection. But the remote server will not be able to connect to you because of the firewall. For these types of firewall, FTP connections need to be done in a passive mode.</p>

<p>There are two that I can think off.</p>

<dl>

<dt id="SOCKS"><a class="permalink" href="CPAN.html#SOCKS">#</a>SOCKS</dt>
<dd>

<p>If you are using a SOCKS firewall, you will need to compile perl and link it with the SOCKS library. This is what is normally called a &#39;socksified&#39; perl. With this executable you will be able to connect to servers outside the firewall as if it were not there.</p>

</dd>
<dt id="IP-Masquerade"><a class="permalink" href="CPAN.html#IP-Masquerade">#</a><a id="IP"></a>IP Masquerade</dt>
<dd>

<p>This is when the firewall implemented in the kernel (via NAT, or networking address translation), it allows you to hide a complete network behind one IP address. With this firewall no special compiling is needed as you can access hosts directly.</p>

<p>For accessing ftp servers behind such firewalls you usually need to set the environment variable <code>FTP_PASSIVE</code> or the config variable ftp_passive to a true value.</p>

</dd>
</dl>

</dd>
</dl>

<h2 id="Configuring-lynx-or-ncftp-for-going-through-a-firewall"><a class="permalink" href="CPAN.html#Configuring-lynx-or-ncftp-for-going-through-a-firewall">#</a><a id="Configuring"></a>Configuring lynx or ncftp for going through a firewall</h2>

<p>If you can go through your firewall with e.g. lynx, presumably with a command such as</p>

<pre><code class="plaintext">/usr/local/bin/lynx -pscott:tiger</code></pre>

<p>then you would configure CPAN.pm with the command</p>

<pre><code class="plaintext">o conf lynx &quot;/usr/local/bin/lynx -pscott:tiger&quot;</code></pre>

<p>That&#39;s all. Similarly for ncftp or ftp, you would configure something like</p>

<pre><code class="plaintext">o conf ncftp &quot;/usr/bin/ncftp -f /home/scott/ncftplogin.cfg&quot;</code></pre>

<p>Your mileage may vary...</p>

<h1 id="FAQ"><a class="permalink" href="CPAN.html#FAQ">#</a>FAQ</h1>

<dl>

<dt id="1)"><a class="permalink" href="CPAN.html#1)">#</a><a id="1"></a><a id="pod1"></a>1)</dt>
<dd>

<p>I installed a new version of module X but CPAN keeps saying, I have the old version installed</p>

<p>Probably you <b>do</b> have the old version installed. This can happen if a module installs itself into a different directory in the @INC path than it was previously installed. This is not really a CPAN.pm problem, you would have the same problem when installing the module manually. The easiest way to prevent this behaviour is to add the argument <code>UNINST=1</code> to the <code>make install</code> call, and that is why many people add this argument permanently by configuring</p>

<pre><code class="plaintext">o conf make_install_arg UNINST=1</code></pre>

</dd>
<dt id="2)"><a class="permalink" href="CPAN.html#2)">#</a><a id="2"></a><a id="pod2"></a>2)</dt>
<dd>

<p>So why is UNINST=1 not the default?</p>

<p>Because there are people who have their precise expectations about who may install where in the @INC path and who uses which @INC array. In fine tuned environments <code>UNINST=1</code> can cause damage.</p>

</dd>
<dt id="3)"><a class="permalink" href="CPAN.html#3)">#</a><a id="3"></a><a id="pod3"></a>3)</dt>
<dd>

<p>I want to clean up my mess, and install a new perl along with all modules I have. How do I go about it?</p>

<p>Run the autobundle command for your old perl and optionally rename the resulting bundle file (e.g. Bundle/mybundle.pm), install the new perl with the Configure option prefix, e.g.</p>

<pre><code class="plaintext">./Configure -Dprefix=/usr/local/perl-5.6.78.9</code></pre>

<p>Install the bundle file you produced in the first step with something like</p>

<pre><code class="plaintext">cpan&gt; install Bundle::mybundle</code></pre>

<p>and you&#39;re done.</p>

</dd>
<dt id="4)"><a class="permalink" href="CPAN.html#4)">#</a><a id="4"></a><a id="pod4"></a>4)</dt>
<dd>

<p>When I install bundles or multiple modules with one command there is too much output to keep track of.</p>

<p>You may want to configure something like</p>

<pre><code class="plaintext">o conf make_arg &quot;| tee -ai /root/.cpan/logs/make.out&quot;
o conf make_install_arg &quot;| tee -ai /root/.cpan/logs/make_install.out&quot;</code></pre>

<p>so that STDOUT is captured in a file for later inspection.</p>

</dd>
<dt id="5)"><a class="permalink" href="CPAN.html#5)">#</a><a id="5"></a><a id="pod5"></a>5)</dt>
<dd>

<p>I am not root, how can I install a module in a personal directory?</p>

<p>As of CPAN 1.9463, if you do not have permission to write the default perl library directories, CPAN&#39;s configuration process will ask you whether you want to bootstrap &lt;local::lib&gt;, which makes keeping a personal perl library directory easy.</p>

<p>Another thing you should bear in mind is that the UNINST parameter can be dangerous when you are installing into a private area because you might accidentally remove modules that other people depend on that are not using the private area.</p>

</dd>
<dt id="6)"><a class="permalink" href="CPAN.html#6)">#</a><a id="6"></a><a id="pod6"></a>6)</dt>
<dd>

<p>How to get a package, unwrap it, and make a change before building it?</p>

<p>Have a look at the <code>look</code> (!) command.</p>

</dd>
<dt id="7)"><a class="permalink" href="CPAN.html#7)">#</a><a id="7"></a><a id="pod7"></a>7)</dt>
<dd>

<p>I installed a Bundle and had a couple of fails. When I retried, everything resolved nicely. Can this be fixed to work on first try?</p>

<p>The reason for this is that CPAN does not know the dependencies of all modules when it starts out. To decide about the additional items to install, it just uses data found in the META.yml file or the generated Makefile. An undetected missing piece breaks the process. But it may well be that your Bundle installs some prerequisite later than some depending item and thus your second try is able to resolve everything. Please note, CPAN.pm does not know the dependency tree in advance and cannot sort the queue of things to install in a topologically correct order. It resolves perfectly well <b>if</b> all modules declare the prerequisites correctly with the PREREQ_PM attribute to MakeMaker or the <code>requires</code> stanza of Module::Build. For bundles which fail and you need to install often, it is recommended to sort the Bundle definition file manually.</p>

</dd>
<dt id="8)"><a class="permalink" href="CPAN.html#8)">#</a><a id="8"></a><a id="pod8"></a>8)</dt>
<dd>

<p>In our intranet, we have many modules for internal use. How can I integrate these modules with CPAN.pm but without uploading the modules to CPAN?</p>

<p>Have a look at the CPAN::Site module.</p>

</dd>
<dt id="9)"><a class="permalink" href="CPAN.html#9)">#</a><a id="9"></a><a id="pod9"></a>9)</dt>
<dd>

<p>When I run CPAN&#39;s shell, I get an error message about things in my <code>/etc/inputrc</code> (or <code>~/.inputrc</code>) file.</p>

<p>These are readline issues and can only be fixed by studying readline configuration on your architecture and adjusting the referenced file accordingly. Please make a backup of the <code>/etc/inputrc</code> or <code>~/.inputrc</code> and edit them. Quite often harmless changes like uppercasing or lowercasing some arguments solves the problem.</p>

</dd>
<dt id="10)"><a class="permalink" href="CPAN.html#10)">#</a><a id="10"></a><a id="pod10"></a>10)</dt>
<dd>

<p>Some authors have strange characters in their names.</p>

<p>Internally CPAN.pm uses the UTF-8 charset. If your terminal is expecting ISO-8859-1 charset, a converter can be activated by setting term_is_latin to a true value in your config file. One way of doing so would be</p>

<pre><code class="plaintext">cpan&gt; o conf term_is_latin 1</code></pre>

<p>If other charset support is needed, please file a bug report against CPAN.pm at rt.cpan.org and describe your needs. Maybe we can extend the support or maybe UTF-8 terminals become widely available.</p>

<p>Note: this config variable is deprecated and will be removed in a future version of CPAN.pm. It will be replaced with the conventions around the family of $LANG and $LC_* environment variables.</p>

</dd>
<dt id="11)"><a class="permalink" href="CPAN.html#11)">#</a><a id="11"></a><a id="pod11"></a>11)</dt>
<dd>

<p>When an install fails for some reason and then I correct the error condition and retry, CPAN.pm refuses to install the module, saying <code>Already tried without success</code>.</p>

<p>Use the force pragma like so</p>

<pre><code class="plaintext">force install Foo::Bar</code></pre>

<p>Or you can use</p>

<pre><code class="plaintext">look Foo::Bar</code></pre>

<p>and then <code>make install</code> directly in the subshell.</p>

</dd>
<dt id="12)"><a class="permalink" href="CPAN.html#12)">#</a><a id="12"></a><a id="pod12"></a>12)</dt>
<dd>

<p>How do I install a &quot;DEVELOPER RELEASE&quot; of a module?</p>

<p>By default, CPAN will install the latest non-developer release of a module. If you want to install a dev release, you have to specify the partial path starting with the author id to the tarball you wish to install, like so:</p>

<pre><code class="plaintext">cpan&gt; install KWILLIAMS/Module-Build-0.27_07.tar.gz</code></pre>

<p>Note that you can use the <code>ls</code> command to get this path listed.</p>

</dd>
<dt id="13)"><a class="permalink" href="CPAN.html#13)">#</a><a id="13"></a><a id="pod13"></a>13)</dt>
<dd>

<p>How do I install a module and all its dependencies from the commandline, without being prompted for anything, despite my CPAN configuration (or lack thereof)?</p>

<p>CPAN uses ExtUtils::MakeMaker&#39;s prompt() function to ask its questions, so if you set the PERL_MM_USE_DEFAULT environment variable, you shouldn&#39;t be asked any questions at all (assuming the modules you are installing are nice about obeying that variable as well):</p>

<pre><code class="plaintext">% PERL_MM_USE_DEFAULT=1 perl -MCPAN -e &#39;install My::Module&#39;</code></pre>

</dd>
<dt id="14)"><a class="permalink" href="CPAN.html#14)">#</a><a id="14"></a><a id="pod14"></a>14)</dt>
<dd>

<p>How do I create a Module::Build based Build.PL derived from an ExtUtils::MakeMaker focused Makefile.PL?</p>

<p>http://search.cpan.org/dist/Module-Build-Convert/</p>

</dd>
<dt id="15)"><a class="permalink" href="CPAN.html#15)">#</a><a id="15"></a><a id="pod15"></a>15)</dt>
<dd>

<p>I&#39;m frequently irritated with the CPAN shell&#39;s inability to help me select a good mirror.</p>

<p>CPAN can now help you select a &quot;good&quot; mirror, based on which ones have the lowest &#39;ping&#39; round-trip times. From the shell, use the command &#39;o conf init urllist&#39; and allow CPAN to automatically select mirrors for you.</p>

<p>Beyond that help, the urllist config parameter is yours. You can add and remove sites at will. You should find out which sites have the best up-to-dateness, bandwidth, reliability, etc. and are topologically close to you. Some people prefer fast downloads, others up-to-dateness, others reliability. You decide which to try in which order.</p>

<p>Henk P. Penning maintains a site that collects data about CPAN sites:</p>

<pre><code class="plaintext">http://mirrors.cpan.org/</code></pre>

<p>Also, feel free to play with experimental features. Run</p>

<pre><code class="plaintext">o conf init randomize_urllist ftpstats_period ftpstats_size</code></pre>

<p>and choose your favorite parameters. After a few downloads running the <code>hosts</code> command will probably assist you in choosing the best mirror sites.</p>

</dd>
<dt id="16)"><a class="permalink" href="CPAN.html#16)">#</a><a id="16"></a><a id="pod16"></a>16)</dt>
<dd>

<p>Why do I get asked the same questions every time I start the shell?</p>

<p>You can make your configuration changes permanent by calling the command <code>o conf commit</code>. Alternatively set the <code>auto_commit</code> variable to true by running <code>o conf init auto_commit</code> and answering the following question with yes.</p>

</dd>
<dt id="17)"><a class="permalink" href="CPAN.html#17)">#</a><a id="17"></a><a id="pod17"></a>17)</dt>
<dd>

<p>Older versions of CPAN.pm had the original root directory of all tarballs in the build directory. Now there are always random characters appended to these directory names. Why was this done?</p>

<p>The random characters are provided by File::Temp and ensure that each module&#39;s individual build directory is unique. This makes running CPAN.pm in concurrent processes simultaneously safe.</p>

</dd>
<dt id="18)"><a class="permalink" href="CPAN.html#18)">#</a><a id="18"></a><a id="pod18"></a>18)</dt>
<dd>

<p>Speaking of the build directory. Do I have to clean it up myself?</p>

<p>You have the choice to set the config variable <code>scan_cache</code> to <code>never</code>. Then you must clean it up yourself. The other possible values, <code>atstart</code> and <code>atexit</code> clean up the build directory when you start (or more precisely, after the first extraction into the build directory) or exit the CPAN shell, respectively. If you never start up the CPAN shell, you probably also have to clean up the build directory yourself.</p>

</dd>
<dt id="19)"><a class="permalink" href="CPAN.html#19)">#</a><a id="19"></a><a id="pod19"></a>19)</dt>
<dd>

<p>How can I switch to sudo instead of local::lib?</p>

<p>The following 5 environment veriables need to be reset to the previous values: PATH, PERL5LIB, PERL_LOCAL_LIB_ROOT, PERL_MB_OPT, PERL_MM_OPT; and these two CPAN.pm config variables must be reconfigured: make_install_make_command and mbuild_install_build_command. The five env variables have probably been overwritten in your $HOME/.bashrc or some equivalent. You either find them there and delete their traces and logout/login or you override them temporarily, depending on your exact desire. The two cpanpm config variables can be set with:</p>

<pre><code class="plaintext">o conf init /install_.*_command/</code></pre>

<p>probably followed by</p>

<pre><code class="plaintext">o conf commit</code></pre>

</dd>
</dl>

<h1 id="COMPATIBILITY"><a class="permalink" href="CPAN.html#COMPATIBILITY">#</a>COMPATIBILITY</h1>

<h2 id="OLD-PERL-VERSIONS"><a class="permalink" href="CPAN.html#OLD-PERL-VERSIONS">#</a><a id="OLD"></a>OLD PERL VERSIONS</h2>

<p>CPAN.pm is regularly tested to run under 5.005 and assorted newer versions. It is getting more and more difficult to get the minimal prerequisites working on older perls. It is close to impossible to get the whole Bundle::CPAN working there. If you&#39;re in the position to have only these old versions, be advised that CPAN is designed to work fine without the Bundle::CPAN installed.</p>

<p>To get things going, note that GBARR/Scalar-List-Utils-1.18.tar.gz is compatible with ancient perls and that File::Temp is listed as a prerequisite but CPAN has reasonable workarounds if it is missing.</p>

<h2 id="CPANPLUS"><a class="permalink" href="CPAN.html#CPANPLUS">#</a>CPANPLUS</h2>

<p>This module and its competitor, the CPANPLUS module, are both much cooler than the other. CPAN.pm is older. CPANPLUS was designed to be more modular, but it was never intended to be compatible with CPAN.pm.</p>

<h2 id="CPANMINUS"><a class="permalink" href="CPAN.html#CPANMINUS">#</a>CPANMINUS</h2>

<p>In the year 2010 App::cpanminus was launched as a new approach to a cpan shell with a considerably smaller footprint. Very cool stuff.</p>

<h1 id="SECURITY-ADVICE"><a class="permalink" href="CPAN.html#SECURITY-ADVICE">#</a><a id="SECURITY1"></a>SECURITY ADVICE</h1>

<p>This software enables you to upgrade software on your computer and so is inherently dangerous because the newly installed software may contain bugs and may alter the way your computer works or even make it unusable. Please consider backing up your data before every upgrade.</p>

<h1 id="BUGS"><a class="permalink" href="CPAN.html#BUGS">#</a>BUGS</h1>

<p>Please report bugs via <a href="http://rt.cpan.org/">http://rt.cpan.org/</a></p>

<p>Before submitting a bug, please make sure that the traditional method of building a Perl module package from a shell by following the installation instructions of that package still works in your environment.</p>

<h1 id="AUTHOR"><a class="permalink" href="CPAN.html#AUTHOR">#</a>AUTHOR</h1>

<p>Andreas Koenig <code>&lt;andk@cpan.org&gt;</code></p>

<h1 id="LICENSE"><a class="permalink" href="CPAN.html#LICENSE">#</a>LICENSE</h1>

<p>This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p>

<p>See <a href="http://www.perl.com/perl/misc/Artistic.html">http://www.perl.com/perl/misc/Artistic.html</a></p>

<h1 id="TRANSLATIONS"><a class="permalink" href="CPAN.html#TRANSLATIONS">#</a>TRANSLATIONS</h1>

<p>Kawai,Takanori provides a Japanese translation of a very old version of this manpage at <a href="http://homepage3.nifty.com/hippo2000/perltips/CPAN.htm">http://homepage3.nifty.com/hippo2000/perltips/CPAN.htm</a></p>

<h1 id="SEE-ALSO"><a class="permalink" href="CPAN.html#SEE-ALSO">#</a><a id="SEE"></a>SEE ALSO</h1>

<p>Many people enter the CPAN shell by running the <a href="cpan.html">cpan</a> utility program which is installed in the same directory as perl itself. So if you have this directory in your PATH variable (or some equivalent in your operating system) then typing <code>cpan</code> in a console window will work for you as well. Above that the utility provides several commandline shortcuts.</p>

<p>melezhik (Alexey) sent me a link where he published a chef recipe to work with CPAN.pm: http://community.opscode.com/cookbooks/cpan.</p>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
